One of the most confusing parts of asynchronous C# is why code behaves differently in a Console app versus a Web API or a Desktop (WPF/WinForms) app. This is determined by the SynchronizationContext.
The SynchronizationContext is like a "Home Base" for a thread. In a WPF app, the "Home Base" is the UI Thread. When an await finishes, C# tries to "come home" to the UI thread to update the screen.
In library code or Web APIs, you don't typically care which thread you resume on. By adding .ConfigureAwait(false), you tell C#: "Don't bother going back to home base; just resume on any available thread."
// ✅ Enterprise Library Best Practice
await _db.SaveAsync().ConfigureAwait(false);
Using ConfigureAwait(false) provides a minor performance boost because it avoids the overhead of context-switching back to the original thread, and more importantly, it prevents many types of deadlocks.
Q: "Why is SynchronizationContext gone in .NET Core (ASP.NET Core)?"
Architect Answer: "In legacy ASP.NET, there was a `HttpContext.Current` that was tied to the thread. This caused massive complexity and performance bottlenecks. In the rewrite (ASP.NET Core), Microsoft fundamentally removed the SynchronizationContext entirely from the server runtime. This is why you don't 'technically' need `ConfigureAwait(false)` inside your ASP.NET Core controllers anymore—but you should still use it in your Class Libraries to ensure they are safe for use in other environments like WPF or legacy apps."