-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VSTHRD110: Warn for asynchronous method not awaited #233
Comments
Similar to #209 |
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. |
Your I should be able to get to this feature request in the next week. |
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).The text was updated successfully, but these errors were encountered: