VSTHRD103 again recommends xUnit's Assert.ThrowsAsync when the delegate under test is synchronous. This was previously tracked and fixed in #61.
With Microsoft.VisualStudio.Threading.Analyzers 18.7.115, code shaped like this is flagged when it appears in an async test method:
Assert.Throws<FormatException>(() => ParseInvalidValue());
The suggested ThrowsAsync API is not semantically appropriate because the operation under test completes synchronously and does not return a Task. Applying the suggestion requires wrapping the synchronous operation in an artificial completed task.
Expected: VSTHRD103 should not report synchronous xUnit assertion calls whose delegate does not return a task.
VSTHRD103 again recommends xUnit's
Assert.ThrowsAsyncwhen the delegate under test is synchronous. This was previously tracked and fixed in #61.With Microsoft.VisualStudio.Threading.Analyzers 18.7.115, code shaped like this is flagged when it appears in an async test method:
The suggested
ThrowsAsyncAPI is not semantically appropriate because the operation under test completes synchronously and does not return aTask. Applying the suggestion requires wrapping the synchronous operation in an artificial completed task.Expected: VSTHRD103 should not report synchronous xUnit assertion calls whose delegate does not return a task.