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
VSTHRD110: Warn for asynchronous method not awaited #233
Compiler warning CS4014 is only reported if the callee is marked with the async modifier (dotnet/roslyn#20782). It would be helpful if an analyzer expanded the analysis to cover cases where the method does not have this modifier (e.g. pass-through asynchronous methods).
This is needed so so very much especially for solutions undergoing a conversion to async patterns. Very often you will change a method to return Task with no intention of it ever being fire-and-forget. You must then very carefully find all usages of the method up the chain and ensure that all callers await the call. Those callers then become async and so on and so on. Without an analyzer for this, the effort is extremely error prone and errors manifest during runtime in a manner which is very difficult to diagnose.
At my prior company, we had analyzers which enforced that fire-and-forget method invocation be explicitly marked by an extension I.E "task.NoWait()". Otherwise, you get an error.
With concerns of backwards compatibility I can see the difficulty in .Net including the analyzer by default... But there must be some way to toggle it on/off for those who need it. This is very common use-case.
Activity
AArnott commentedon Apr 6, 2018
Similar to #209
jstutson commentedon May 10, 2018
This is needed so so very much especially for solutions undergoing a conversion to async patterns. Very often you will change a method to return Task with no intention of it ever being fire-and-forget. You must then very carefully find all usages of the method up the chain and ensure that all callers await the call. Those callers then become async and so on and so on. Without an analyzer for this, the effort is extremely error prone and errors manifest during runtime in a manner which is very difficult to diagnose.
At my prior company, we had analyzers which enforced that fire-and-forget method invocation be explicitly marked by an extension I.E "task.NoWait()". Otherwise, you get an error.
With concerns of backwards compatibility I can see the difficulty in .Net including the analyzer by default... But there must be some way to toggle it on/off for those who need it. This is very common use-case.
AArnott commentedon May 10, 2018
Your
NoWait()extension method sounds analogous to theForget()extension method that we define within this project.I should be able to get to this feature request in the next week.
[-]Warn for asynchronous method not awaited[/-][+]VSTHRD110: Warn for asynchronous method not awaited[/+]Add VSTHRD110: Observe result of async calls
Bump xunit.runner.visualstudio from 2.5.3 to 2.5.4 (microsoft#233)