diff --git a/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs b/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs index 9246404f96..bc3aa49308 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/AssemblyResolver.cs @@ -159,11 +159,6 @@ public void Dispose() void AddSearchDirectoriesFromRunSetting(List recursiveDirectoryPath) { // Enqueue elements from the list in Queue - if (recursiveDirectoryPath == null) - { - return; - } - foreach (RecursiveDirectoryPath recPath in recursiveDirectoryPath) { _directoryList.Enqueue(recPath); diff --git a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestContextImplementation.cs b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestContextImplementation.cs index 78bce06425..f08e3c904c 100644 --- a/src/Adapter/MSTestAdapter.PlatformServices/Services/TestContextImplementation.cs +++ b/src/Adapter/MSTestAdapter.PlatformServices/Services/TestContextImplementation.cs @@ -255,12 +255,6 @@ public void SetDataConnection(object? dbConnection) /// True if found. public bool TryGetPropertyValue(string propertyName, out object? propertyValue) { - if (_properties == null) - { - propertyValue = null; - return false; - } - return _properties.TryGetValue(propertyName, out propertyValue); } diff --git a/src/Analyzers/MSTest.Analyzers.CodeFixes/TestMethodShouldBeValidCodeFix.cs b/src/Analyzers/MSTest.Analyzers.CodeFixes/TestMethodShouldBeValidCodeFix.cs index 263cfe53e2..9e08a6c656 100644 --- a/src/Analyzers/MSTest.Analyzers.CodeFixes/TestMethodShouldBeValidCodeFix.cs +++ b/src/Analyzers/MSTest.Analyzers.CodeFixes/TestMethodShouldBeValidCodeFix.cs @@ -109,8 +109,7 @@ private static async Task FixTestMethodAsync(Document document, Method INamedTypeSymbol? taskSymbol = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemThreadingTasksTask); INamedTypeSymbol? valueTaskSymbol = wellKnownTypeProvider.GetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemThreadingTasksValueTask); - if (newMethodDeclaration.ReturnType != null && - !newMethodDeclaration.ReturnType.IsVoid() && + if (!newMethodDeclaration.ReturnType.IsVoid() && (taskSymbol == null || !semanticModel.ClassifyConversion(methodDeclaration.ReturnType, taskSymbol).IsImplicit) && (valueTaskSymbol == null || !semanticModel.ClassifyConversion(methodDeclaration.ReturnType, valueTaskSymbol).IsImplicit)) { diff --git a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ContextAdapterBase.cs b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ContextAdapterBase.cs index 49579940eb..f6c05b2396 100644 --- a/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ContextAdapterBase.cs +++ b/src/Platform/Microsoft.Testing.Extensions.VSTestBridge/ObjectModel/ContextAdapterBase.cs @@ -24,7 +24,6 @@ protected ContextAdapterBase(ICommandLineOptions commandLineOptions, IRunSetting if (commandLineOptions.TryGetOptionArgumentList( TestCaseFilterCommandLineOptionsProvider.TestCaseFilterOptionName, out string[]? filterExpressions) - && filterExpressions is not null && filterExpressions.Length == 1) { filterFromCommandLineOption = filterExpressions[0]; diff --git a/src/Platform/Microsoft.Testing.Platform/Services/StopPoliciesService.cs b/src/Platform/Microsoft.Testing.Platform/Services/StopPoliciesService.cs index be2f89dfd7..d3a224e95e 100644 --- a/src/Platform/Microsoft.Testing.Platform/Services/StopPoliciesService.cs +++ b/src/Platform/Microsoft.Testing.Platform/Services/StopPoliciesService.cs @@ -33,10 +33,6 @@ public async Task ExecuteMaxFailedTestsCallbacksAsync(int maxFailedTests, Cancel { _lastMaxFailedTests = maxFailedTests; IsMaxFailedTestsTriggered = true; - if (_maxFailedTestsCallbacks is null) - { - return; - } foreach (Func callback in _maxFailedTestsCallbacks) { diff --git a/src/Platform/Microsoft.Testing.Platform/Telemetry/TelemetryManager.cs b/src/Platform/Microsoft.Testing.Platform/Telemetry/TelemetryManager.cs index 5f688ea895..3c38b7c522 100644 --- a/src/Platform/Microsoft.Testing.Platform/Telemetry/TelemetryManager.cs +++ b/src/Platform/Microsoft.Testing.Platform/Telemetry/TelemetryManager.cs @@ -101,12 +101,9 @@ private async Task ShowTelemetryBannerFirstNoticeAsync(ServiceProvider servicePr ITestApplicationModuleInfo testApplicationModuleInfo = serviceProvider.GetTestApplicationModuleInfo(); #pragma warning disable RS0030 // Do not use banned APIs - There is no easy way to disable it for all members - string? directory = environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.Create); + string directory = environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.Create); #pragma warning restore RS0030 // Do not use banned APIs - if (directory is not null) - { - directory = Path.Combine(directory, "Microsoft", "TestingPlatform"); - } + directory = Path.Combine(directory, "Microsoft", "TestingPlatform"); IFileSystem fileSystem = serviceProvider.GetFileSystem(); string fileName = testApplicationModuleInfo.TryGetCurrentTestApplicationFullPath() is { } testApplicationFullPath