diff --git a/src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.Configuration.cs b/src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.Configuration.cs index 12be7df0c3..6768b0b290 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.Configuration.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/MSTestSettings.Configuration.cs @@ -212,13 +212,12 @@ internal static void SetSettingsFromConfig(IConfiguration configuration, IMessag if (configuration["mstest:parallelism:workers"] is string workers) { - settings.ParallelizationWorkers = int.TryParse(workers, out int parallelWorkers) - ? parallelWorkers == 0 - ? Environment.ProcessorCount - : parallelWorkers > 0 - ? parallelWorkers - : throw new AdapterSettingsException(string.Format(CultureInfo.CurrentCulture, Resource.InvalidParallelWorkersValue, workers)) - : throw new AdapterSettingsException(string.Format(CultureInfo.CurrentCulture, Resource.InvalidParallelWorkersValue, workers)); + if (!int.TryParse(workers, out int parallelWorkers) || parallelWorkers < 0) + { + throw new AdapterSettingsException(string.Format(CultureInfo.CurrentCulture, Resource.InvalidParallelWorkersValue, workers)); + } + + settings.ParallelizationWorkers = parallelWorkers == 0 ? Environment.ProcessorCount : parallelWorkers; } if (configuration["mstest:parallelism:scope"] is string value) diff --git a/src/Platform/Microsoft.Testing.Extensions.VideoRecorder/VideoRecorderSessionHandler.cs b/src/Platform/Microsoft.Testing.Extensions.VideoRecorder/VideoRecorderSessionHandler.cs index f11434b159..2b95051bf4 100644 --- a/src/Platform/Microsoft.Testing.Extensions.VideoRecorder/VideoRecorderSessionHandler.cs +++ b/src/Platform/Microsoft.Testing.Extensions.VideoRecorder/VideoRecorderSessionHandler.cs @@ -76,17 +76,19 @@ public VideoRecorderSessionHandler( _options = options; _enabled = commandLineOptions.IsOptionSet(VideoRecorderCommandLineProvider.EnableOptionName); - if (!_enabled) + if (_enabled) { - _persistMode = options.PersistMode; - _granularity = options.Granularity; - return; + ApplyCommandLineOverrides(options, commandLineOptions); } - ApplyCommandLineOverrides(options, commandLineOptions); _persistMode = options.PersistMode; _granularity = options.Granularity; + if (!_enabled) + { + return; + } + string outputDirectory = options.OutputDirectory ?? Path.Combine(configuration.GetTestResultDirectory(), "VideoRecordings");