Closed rcollette closed 1 year ago
When you remove the await
, you'll also need to remove the async
in the method signature.
That works for me.
.WithMessage
is an async function. If I remove the await, and the async from the test method, I get another error.
MA0134: Observe result of async calls
VSTHRD110: Observe the awaitable result of this method call by awaiting it, assigning to a variable, or passing it to another method.
How about returning the value (Task
) then?
🤦 So sorry. Part of this is from working in the JavaScript world where having test functions returning promises is generally a nightmare vs. using async/await. I think I automatically default to using async/await on .NET test methods, thinking that the test framework is just going to skip past the test without waiting for the result.
Thanks again.
Happy to help!
I get a conflicting report that await is not necessary on the last line of this code snippet, but then the compiler complains if I remote the await.