async method recommend response is Task, and should be forbidden used with void.
await will sync the method.
more info
you can only use await inside a method if that method is async and async methods need to return Task, Task<T> or void although void returning async methods are reserved for event handlers because the exceptions thrown within them are swallowed and you cannot await their completion or chain subsequent tasks.
The reason of program shutdown when service throw an exception is the incorrect use of async & await. The docs about async & await as follow:
Async void methods are generally discouraged for code other than event handlers because callers cannot await those methods and must implement a different mechanism to report successful completion or error conditions.
notice
async method recommend response is Task, and should be forbidden used with void.
await will sync the method.
more info
you can only use await inside a method if that method is async and async methods need to return Task,
Task<T>
or void although void returning async methods are reserved for event handlers because the exceptions thrown within them are swallowed and you cannot await their completion or chain subsequent tasks.The reason of program shutdown when service throw an exception is the incorrect use of async & await. The docs about async & await as follow:
reference