Back to Basics: Efficient Async and Await
summary
Shows exactly what causes deadlocks: blocking a Task with .Result or Wait on a UI or request thread and how that state machine generated by async/await marshals continuations back to the original context. Demonstrates concrete fixes: replace async void with Task, use Task.Run to offload CPU work, remove needless awaits to avoid extra state machines, use CancellationToken and IAsyncEnumerable for streaming/cancelable work, and use ConfigureAwait(false) (or platform-appropriate alternatives) in libraries. Includes WPF demos (Dispatcher), Task.WhenAll, and a live deadlock example.
AI-written summary · about
chapters (10)
- 0:00Start
- 1:22Why bother?
- 4:42Blocking - Non Blocking Code
- 6:29Task Parallel Library
- 6:59What's a Task?
- 16:09async & await
- 27:46State Machine?
- 28:41What does applying async really do?
- 29:57Inside the State Machine
- 35:16Deadlocks...
related talks
57mBack to Basics: Efficient Async and Await
59mAsynchronous Programming From The Ground Up
01h 15mBest Practices for Using async and await
01h 00mAvoiding common pitfalls with async/await
01h 00mCorrecting Common Async/Await Mistakes in .NET
55mAsync internals in .NET
57mAsync programming in .NET: Best practices
01h 11mEverything You (Don’t) Want to Know About Async and Await in C#
