- 1. Processes are always crashed by exceptions thrown by async void methods.
- 2. Even the option to wait for the result is not available to callers.
- 3. The caller cannot report exceptions to telemetry.
- 4. If your VS package was started in this manner, it is unable to be responsibly blocked in Package.Close until your async work is complete.
- 5. Use caution: when passing an async delegate or async () => become async void methods when passed to a method that accepts Action delegates. If a method accepts Func<Task> or Func<Task<T>> parameters, only pass async delegates to those methods.
Saturday, January 28, 2023
Why should you avoid making async void methods? Make the methods instead return Task.
Why should you avoid making async void methods? Make the methods instead return Task.
Subscribe to:
Posts (Atom)
A Deep Dive into Computed Columns in Entity Framework Core
Entity Framework Core (EF Core) is a popular Object-Relational Mapping (ORM) framework that simplifies database access for .NET applications...
-
Entity Framework Core (EF Core) is a popular Object-Relational Mapping (ORM) framework that simplifies database access for .NET applications...
-
Json Web Token (JWT) based authentication by using ASP.Net Web API with the help of OWIN middle-ware, ASP .Net Identity and AngularJs Client...
-
Building Umbraco 11 with dotnet 7 and running the web app in the docker container Since its original release in March 2013, Docker has been...