Correcting Common Mistakes in Asynchronous .NET Code
summary
The .NET compiler turns every async method into a generated state-machine class that adds about 100 bytes and a MoveNext method wrapped in a try/catch that swallows exceptions unless awaited. Recommendations: avoid Task.Wait/Task.Result (use GetAwaiter().GetResult if you must), prefer await, use ConfigureAwait(false) in non-UI layers to avoid needless thread hops, and restrict async void to event handlers. Provides a SafeFireAndForget extension and an AsyncCommand NuGet, plus a ValueTask suggestion for hot paths to reduce allocations and improve performance and exception behavior.
AI-written summary · about
chapters (13)
- 0:00Start
- 1:58Multi-Threading
- 2:38Thread Pool
- 4:13Thread 1
- 6:21Synchronization Context
- 7:06Intermediate Language
- 21:14Execute Refresh Command
- 27:13Exception Handling
- 29:52Get Top Stories
- 36:39Value Task
- 39:37Mvvm
- 41:59Resources
- 46:42Set the Property That Will Change the Ui with the Data Binding
related talks
01h 05mCorrecting Common Async/Await Mistakes in .NET 10
01h 00mCorrecting Common Async/Await Mistakes in .NET
01h 01mCorrecting Common Async/Await Mistakes in .NET 9
56mCorrecting Common Async/Await Mistakes in .NET 8
01h 00mCorrecting Common Async/Await Mistakes in .NET 8
57mBack to Basics: Efficient Async and Await
59mAsynchronous Programming From The Ground Up
01h 00mAvoiding common pitfalls with async/await
