Advertisement
Intermediate C#, Asynchronous Programming

What does ConfigureAwait(false) do?

Short answer

It resumes the continuation without capturing the synchronization context, avoiding a needless hop and reducing deadlocks. Use it in library code that doesn't touch UI/HttpContext.

Save C# mock interview
Advertisement
AModel answer
It resumes the continuation without capturing the synchronization context, avoiding a needless hop and reducing deadlocks. Use it in library code that doesn't touch UI/HttpContext.
var body = await h.GetStringAsync(url).ConfigureAwait(false);
Real-world example
A reusable NuGet library uses it so apps that block on it don't deadlock.