.NET: Asyn http client - anatomy and traps
summary
Demonstrates compiler-generated state machines by compiling C# on SharpLab.io, builds a custom awaiter (starts a thread, sleeps, calls the registered callback) and shows it works but isn’t true non-blocking async; traces real non-blocking behavior to sockets using a socket async context loop / poll or IO completion ports plus a small thread pool that demultiplexes callbacks; shows practical traps: WhenAny returns a task reference (need to await it to observe exceptions) and WhenAll exposes only one rethrown exception unless inspected.
AI-written summary · about
chapters (7)
- 0:00Introduction and agenda
- 1:17Async/await compiler internals
- 8:48Who resumes async flow
- 11:37Custom awaitable implementation
- 26:24HTTP client async I/O mechanics
- 35:37Traps with WhenAll and WhenAny
- 41:56Summary and key takeaways
related talks
56mCorrecting Common Async/Await Mistakes in .NET 8
55mAsync internals in .NET
59mAsynchronous Programming From The Ground Up
01h 01mCorrecting Common Async/Await Mistakes in .NET 9
01h 00mCorrecting Common Async/Await Mistakes in .NET 8
01h 11mEverything You (Don’t) Want to Know About Async and Await in C#
58mBack to Basics: Efficient Async and Await
57mAsync programming in .NET: Best practices
