Add analyzer to detect async void usage
Open
analyzer
area-minimal
area-mvc
enhancement
investigate
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 276
Description
There are a couple of places where async void can be used by mistake in ASP.NET applications (and minimal APIs) and we should flag this and error with an analyzer:
- [ ] Startup.Configure/ConfigureServices
- [ ] MVC Controller Action methods
- [ ] Razor Page handlers (https://stackoverflow.com/questions/67794528/cannot-access-a-disposed-object-object-name-iserviceprovider-error-in-aspnet)
- [ ] MVC filters (the non IAsync*Filters)
- [ ] SignalR Hub Methods
- [ ] Minimal APIs returning void
We should flag all of these areas with a single analyzer and add more as we see fit.
Contributor guide
Assessment
This issue has not been assessed yet.