Avoiding common pitfalls with async/await
summary
Explains why async turns methods into a compiler-generated state machine, how await pauses on a Task or ValueTask and resumes on the captured context (demoed in a WPF app), and why avoid async void and don't block async actually break shutdown, deadlock or starve the thread pool; lists dangerous APIs (ContinueWith, StartNew, Task ctor), rules for ValueTask: consume once, never block, how WaitAsync cancels the await not the underlying task, and includes sample slides and channel demos.
AI-written summary · about
chapters (12)
- 0:00Introduction and context
- 3:06Async and await basics
- 7:05How await works
- 12:24Common conceptual mistakes
- 14:15Async mental models
- 18:44Async in UI applications
- 21:43Tasks and ValueTasks
- 26:04Top async pitfalls
- 30:53Other common mistakes
- 36:56Advanced pitfalls
- 45:44Task composition and tools
- 55:54Bonus round and conclusion
related talks
59mAsynchronous Programming From The Ground Up
58mBack to Basics: Efficient Async and Await
01h 11mEverything You (Don’t) Want to Know About Async and Await in C#
55mAsync internals in .NET
01h 00mCorrecting Common Async/Await Mistakes in .NET
51mAsync Internals in .NET
49mCorrecting Common Mistakes in Asynchronous .NET Code
01h 05mCorrecting Common Async/Await Mistakes in .NET 10
