Interview frequency: …
Short answer
It tells the runtime not to return to the original SynchronizationContext after await; it used to prevent Deadlocks in UI apps and libraries.
Explanation
In environments such as WPF or classic ASP.NET, a SynchronizationContext required continuations after await to run on the same main thread. If synchronous code called .Result while internal code awaited, the caller would hold the main thread while waiting for a continuation that needed it, causing a Deadlock. ConfigureAwait(false) lets execution resume on any available ThreadPool thread. Modern ASP.NET Core has no SynchronizationContext, but ConfigureAwait(false) remains a recommended practice for reusable libraries (Class Libraries).
Code example
// In shared libraries:
await httpClient.GetStringAsync(url).ConfigureAwait(false);Common mistakes
- Believing that omitting ConfigureAwait(false) causes Deadlocks in ASP.NET Core; ASP.NET Core has no SynchronizationContext.