You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Assert.MultipleAsync -> EnterMultipleScope autofix produce invalid codeΒ #888
I wonder if it would be enough to check for the async modifier or alternatively extend the return type check with generic Task, ValueTask, and generic ValueTask.
I should have time to look at this tonight or tomorrow
FWIW I agree about only needing to check async. It's technically valid C# to use async void but NUnit hasn't permitted it in tests for quite a while within either the framework or analyzers. We should be able to assume any existing return type is awaitable.
Activity
MaceWindu commentedon Jun 12, 2025
Actually it is even worse.
ValueTask -> Taskconversion is not a big deal, but it also replace generic tasks withTask.mikkelbu commentedon Jun 12, 2025
Thanks for the report @MaceWindu. I can see that I made an mistake in the
IsAsyncTaskMethodnunit.analyzers/src/nunit.analyzers.codefixes/UseAssertEnterMultipleScope/UseAssertEnterMultipleScopeCodeFix.cs
Lines 127 to 134 in 4bb3e38
I wonder if it would be enough to check for the async modifier or alternatively extend the return type check with generic Task, ValueTask, and generic ValueTask.
I should have time to look at this tonight or tomorrow
manfred-brands commentedon Jun 12, 2025
@mikkelbu I think it should indeed be enough to check only for the
asyncmodifier. If it exists, no changes are needed.stevenaw commentedon Jun 12, 2025
FWIW I agree about only needing to check
async. It's technically valid C# to useasync voidbut NUnit hasn't permitted it in tests for quite a while within either the framework or analyzers. We should be able to assume any existing return type is awaitable.