async void
An async method that returns void instead of Task, so its caller cannot await it or catch its exceptions.
An unhandled exception in async void tears down the process instead of reaching your error handling.
In more detail
An exception inside it is raised on the thread pool and can crash the whole process. The only legitimate use is an event handler; everything else should return Task.
Related terms
- async and await — Language keywords for writing code that waits for slow work, such as a network call, without blocking a thread.
- Task — The .NET type representing an operation that may still be running and will eventually complete with a result, an exception or cancellation.
- event handler — A function that runs when something happens to an element, such as a click (onClick) or a key press (onKeyDown).
Taught in
- Async and Await: Managing Concurrency — Modern .NET Core, C# & Enterprise Microservices