Add code fix for MSTEST0040 — AvoidUsingAssertsInAsyncVoidContext #7892
Build #20260514.9 had test failures
Details
- Failed: 12 (0.06%)
- Passed: 19,122 (99.17%)
- Other: 148 (0.77%)
- Total: 19,282
- 89699 of 134257 blocks covered (66.81%)
- 62935 of 96542 lines covered (65.19%)
Annotations
Check failure on line 5610 in Build log
azure-pipelines / microsoft.testfx
Build log #L5610
Bash exited with code '2'.
azure-pipelines / microsoft.testfx
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>
}
azure-pipelines / microsoft.testfx
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>
}
azure-pipelines / microsoft.testfx
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>
}
azure-pipelines / microsoft.testfx
MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidLocalFunction_MissingTasksUsing_AddsUsing
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>
}
Raw output
at Microsoft.CodeAnalysis.Testing.DefaultVerifier.Fail(String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/DefaultVerifier.cs:line 105
at Microsoft.CodeAnalysis.Testing.IVerifierExtensions.EqualOrDiff(IVerifier verifier, String expected, String actual, String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/Extensions/IVerifierExtensions.cs:line 67
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyProjectAsync(ProjectState newState, Project project, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 537
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyFixAsync(String language, ImmutableArray`1 analyzers, ImmutableArray`1 codeFixProviders, SolutionState oldState, SolutionState newState, Int32 numberOfIterations, Func`10 getFixedProject, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 515
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyFixAsync(SolutionState testState, SolutionState fixedState, SolutionState batchFixedState, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 477
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.RunImplAsync(CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 316
at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.RunAsync(CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 172
at MSTest.Analyzers.Test.CSharpCodeFixVerifier`2.VerifyCodeFixAsync(String source, DiagnosticResult[] expected, String fixedSource) in /_/test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs:line 92
at MSTest.Analyzers.Test.CSharpCodeFixVerifier`2.VerifyCodeFixAsync(String source, String fixedSource) in /_/test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs:line 58
at MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidLocalFunction_MissingTasksUsing_AddsUsing() in /_/test/UnitTests/MSTest.Analyzers.UnitTests/AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.cs:line 443
at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestMethodInfo.ExecuteInternalAsync(Object[] arguments, CancellationTokenSource timeoutTokenSource) in /_/src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs:line 129
azure-pipelines / microsoft.testfx
MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_WithoutTaskUsing_AddsTaskUsingInCorrectPosition
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>
}
Raw output
at Microsoft.CodeAnalysis.Testing.DefaultVerifier.Fail(String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/DefaultVerifier.cs:line 105
at Microsoft.CodeAnalysis.Testing.IVerifierExtensions.EqualOrDiff(IVerifier verifier, String expected, String actual, String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/Extensions/IVerifierExtensions.cs:line 67
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyProjectAsync(ProjectState newState, Project project, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 537
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyFixAsync(String language, ImmutableArray`1 analyzers, ImmutableArray`1 codeFixProviders, SolutionState oldState, SolutionState newState, Int32 numberOfIterations, Func`10 getFixedProject, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 515
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyFixAsync(SolutionState testState, SolutionState fixedState, SolutionState batchFixedState, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 477
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.RunImplAsync(CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 316
at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.RunAsync(CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 172
at MSTest.Analyzers.Test.CSharpCodeFixVerifier`2.VerifyCodeFixAsync(String source, DiagnosticResult[] expected, String fixedSource) in /_/test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs:line 92
at MSTest.Analyzers.Test.CSharpCodeFixVerifier`2.VerifyCodeFixAsync(String source, String fixedSource) in /_/test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs:line 58
at MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_WithoutTaskUsing_AddsTaskUsingInCorrectPosition() in /_/test/UnitTests/MSTest.Analyzers.UnitTests/AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.cs:line 135
at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestMethodInfo.ExecuteInternalAsync(Object[] arguments, CancellationTokenSource timeoutTokenSource) in /_/src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs:line 129
azure-pipelines / microsoft.testfx
MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_MissingTasksUsing_Diagnostic
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>
}
Raw output
at Microsoft.CodeAnalysis.Testing.DefaultVerifier.Fail(String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/DefaultVerifier.cs:line 105
at Microsoft.CodeAnalysis.Testing.IVerifierExtensions.EqualOrDiff(IVerifier verifier, String expected, String actual, String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/Extensions/IVerifierExtensions.cs:line 67
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyProjectAsync(ProjectState newState, Project project, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 537
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyFixAsync(String language, ImmutableArray`1 analyzers, ImmutableArray`1 codeFixProviders, SolutionState oldState, SolutionState newState, Int32 numberOfIterations, Func`10 getFixedProject, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 515
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyFixAsync(SolutionState testState, SolutionState fixedState, SolutionState batchFixedState, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 477
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.RunImplAsync(CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 316
at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.RunAsync(CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 172
at MSTest.Analyzers.Test.CSharpCodeFixVerifier`2.VerifyCodeFixAsync(String source, DiagnosticResult[] expected, String fixedSource) in /_/test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs:line 92
at MSTest.Analyzers.Test.CSharpCodeFixVerifier`2.VerifyCodeFixAsync(String source, String fixedSource) in /_/test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs:line 58
at MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_MissingTasksUsing_Diagnostic() in /_/test/UnitTests/MSTest.Analyzers.UnitTests/AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.cs:line 641
at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestMethodInfo.ExecuteInternalAsync(Object[] arguments, CancellationTokenSource timeoutTokenSource) in /_/src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs:line 129
azure-pipelines / microsoft.testfx
MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_GlobalUsingPresent_InsertsAfterGlobalUsings
Test method MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_GlobalUsingPresent_InsertsAfterGlobalUsings threw exception:
System.InvalidOperationException: Context: Iterative code fix application
content of '/0/Test0.cs' did not match. Diff shown with expected as baseline:
global using Microsoft.VisualStudio.TestTools.UnitTesting;<LF>
using System;<LF>
-using System.Threading.Tasks;<LF>
+using System.Threading.Tasks;<CR><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>
var _ = nameof(Console);<LF>
Assert.Fail("");<LF>
}<LF>
}
Raw output
at Microsoft.CodeAnalysis.Testing.DefaultVerifier.Fail(String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/DefaultVerifier.cs:line 105
at Microsoft.CodeAnalysis.Testing.IVerifierExtensions.EqualOrDiff(IVerifier verifier, String expected, String actual, String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/Extensions/IVerifierExtensions.cs:line 67
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyProjectAsync(ProjectState newState, Project project, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 537
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyFixAsync(String language, ImmutableArray`1 analyzers, ImmutableArray`1 codeFixProviders, SolutionState oldState, SolutionState newState, Int32 numberOfIterations, Func`10 getFixedProject, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 515
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyFixAsync(SolutionState testState, SolutionState fixedState, SolutionState batchFixedState, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 477
at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.RunImplAsync(CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 316
at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.RunAsync(CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 172
at MSTest.Analyzers.Test.CSharpCodeFixVerifier`2.VerifyCodeFixAsync(String source, DiagnosticResult[] expected, String fixedSource) in /_/test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs:line 92
at MSTest.Analyzers.Test.CSharpCodeFixVerifier`2.VerifyCodeFixAsync(String source, String fixedSource) in /_/test/UnitTests/MSTest.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs:line 58
at MSTest.Analyzers.UnitTests.AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.UseAssertMethodInAsyncVoidMethod_GlobalUsingPresent_InsertsAfterGlobalUsings() in /_/test/UnitTests/MSTest.Analyzers.UnitTests/AvoidUsingAssertsInAsyncVoidContextAnalyzerTests.cs:line 912
at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestMethodInfo.ExecuteInternalAsync(Object[] arguments, CancellationTokenSource timeoutTokenSource) in /_/src/Adapter/MSTestAdapter.PlatformServices/Execution/TestMethodInfo.Execution.cs:line 129