Skip to content

Address review comments: multi-namespace import scoping & net8 test c…

0488837
Select commit
Loading
Failed to load commit list.
Open

Add code fix for MSTEST0040 — AvoidUsingAssertsInAsyncVoidContext #7892

Address review comments: multi-namespace import scoping & net8 test c…
0488837
Select commit
Loading
Failed to load commit list.
Azure Pipelines / microsoft.testfx (Build MacOS Debug) failed May 14, 2026 in 49m 12s

Build MacOS Debug failed

Annotations

Check failure on line 92 in test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs

See this annotation in the file changed.

@azure-pipelines azure-pipelines / microsoft.testfx (Build MacOS Debug)

test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs#L92

test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs(92,1): error : [UseAssertMethodInAsyncVoidMethod_WithoutTaskUsing_AddsTaskUsingInCorrectPosition] [net8.0] Test method MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_WithoutTaskUsing_AddsTaskUsingInCorrectPosition threw exception:
System.InvalidOperationException: Context: Iterative code fix application
content of '/0/Test0.cs' did not match. Diff shown with expected as baseline:
 using System;<LF>
-using System.Threading.Tasks;<LF>
+using System.Threading.Tasks;<CR><LF>
 using Microsoft.VisualStudio.TestTools.UnitTesting;<LF>
 <LF>[TestClass]<LF>
 public class MyTestClass<LF>
 {<LF>
     [TestMethod]<LF>
     public async Task TestMethod()<LF>
     {<LF>
         await System.Threading.Tasks.Task.Delay(1);<LF>
         Assert.Fail("");<LF>
     }<LF>
 }

Check failure on line 92 in test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs

See this annotation in the file changed.

@azure-pipelines azure-pipelines / microsoft.testfx (Build MacOS Debug)

test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs#L92

test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs(92,1): error : [UseAssertMethodInAsyncVoidLocalFunction_MissingTasksUsing_AddsUsing] [net8.0] Test method MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidLocalFunction_MissingTasksUsing_AddsUsing threw exception:
System.InvalidOperationException: Context: Iterative code fix application
content of '/0/Test0.cs' did not match. Diff shown with expected as baseline:
-using System.Threading.Tasks;<LF>
+using System.Threading.Tasks;<CR><LF>
 using Microsoft.VisualStudio.TestTools.UnitTesting;<LF>
 <LF>[TestClass]<LF>
 public class MyTestClass<LF>
 {<LF>
     [TestMethod]<LF>
     public void TestMethod()<LF>
     {<LF>
         async Task d()<LF>
         {<LF>
             Assert.Fail("");<LF>
         };<LF>
     }<LF>
 }

Check failure on line 92 in test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs

See this annotation in the file changed.

@azure-pipelines azure-pipelines / microsoft.testfx (Build MacOS Debug)

test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs#L92

test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs(92,1): error : [UseAssertMethodInAsyncVoidMethod_MissingTasksUsing_Diagnostic] [net8.0] Test method MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_MissingTasksUsing_Diagnostic threw exception:
System.InvalidOperationException: Context: Iterative code fix application
content of '/0/Test0.cs' did not match. Diff shown with expected as baseline:
-using System.Threading.Tasks;<LF>
+using System.Threading.Tasks;<CR><LF>
 using Microsoft.VisualStudio.TestTools.UnitTesting;<LF>
 <LF>[TestClass]<LF>
 public class MyTestClass<LF>
 {<LF>
     [TestMethod]<LF>
     public async Task TestMethod()<LF>
     {<LF>
         Assert.Fail("");<LF>
     }<LF>
 }

Check failure on line 92 in test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs

See this annotation in the file changed.

@azure-pipelines azure-pipelines / microsoft.testfx (Build MacOS Debug)

test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs#L92

test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs(92,1): error : [UseAssertMethodInAsyncVoidMethod_UsingsOrderedAlphabetically] [net8.0] Test method MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_UsingsOrderedAlphabetically threw exception:
System.InvalidOperationException: Context: Iterative code fix application
content of '/0/Test0.cs' did not match. Diff shown with expected as baseline:
 using System.Collections;<LF>
-using System.Threading.Tasks;<LF>
+using System.Threading.Tasks;<CR><LF>
 using System.Xml;<LF>
 using Microsoft.VisualStudio.TestTools.UnitTesting;<LF>
 <LF>[TestClass]<LF>
 public class MyTestClass<LF>
 {<LF>
     [TestMethod]<LF>
     public async Task TestMethod()<LF>
     {<LF>
         await System.Threading.Tasks.Task.Delay(1);<LF>
         Assert.Fail("");<LF>
         _ = nameof(XmlReader);<LF>
     }<LF>
 }

Check failure on line 92 in test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs

See this annotation in the file changed.

@azure-pipelines azure-pipelines / microsoft.testfx (Build MacOS Debug)

test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs#L92

test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs(92,1): error : [UseAssertMethodInAsyncVoidMethod_FileScopedNamespace_AddsUsingAtFileScope] [net8.0] Test method MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_FileScopedNamespace_AddsUsingAtFileScope threw exception:
System.InvalidOperationException: Context: Iterative code fix application
content of '/0/Test0.cs' did not match. Diff shown with expected as baseline:
-using System.Threading.Tasks;<LF>
+using System.Threading.Tasks;<CR><LF>
 using Microsoft.VisualStudio.TestTools.UnitTesting;<LF>
 <LF>namespace MyNamespace;<LF>
 <LF>[TestClass]<LF>
 public class MyTestClass<LF>
 {<LF>
     [TestMethod]<LF>
     public async Task TestMethod()<LF>
     {<LF>
         await System.Threading.Tasks.Task.Delay(1);<LF>
         Assert.Fail("");<LF>
     }<LF>
 }