Async void is evil, but why? It should only be used for event handlers, but how? This video discusses why async void is evil and suggest a trick to work with it when necessary.
Resources
Extension method to call task within an event handler with callbacks:
https://github.com/xiaomi7732/CodeWit...
Console Application Demo Code: https://github.com/xiaomi7732/CodeWit...
WPF Demo Code: https://github.com/xiaomi7732/CodeWit...
NumberIt (CodeName:K) source code: https://github.com/xiaomi7732/CodeWit...
Discord server for Code w/ Saar: / discord
Reach me on twitter @CodeWithSaar
If you want to buy me a coffee: https://www.buymeacoffee.com/codewith... and thank you!
Chapters
00:00 Intro
00:19 Understand why async void is evil
02:11 How async void exception crashed the process
03:22 Where async void is a must
06:21 How to work with async void safely
08:51 Improve the implementation by separate the task and the error handling
10:41 Improve it further: Use extension methods