You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you’re writing general-purpose library code, use ConfigureAwait(false).
For more information you can read Stephen Cleary's article, ConfigureAwait FAQ
If you think ConfigureAwait(false) is no longer necessary in .NET Core or ASP.NET Core. It's wrong.
ASP.NET Core has not own SynchronizationContext. That means that code running in an ASP.NET Core app by default won’t see a custom SynchronizationContext, which lessens the need for ConfigureAwait(false) running in such an environment.
But it doesn’t mean, however, that there will never be a custom SynchronizationContext or TaskScheduler present. If some user code (or other library code your app is using) sets a custom context and calls your code, or invokes your code in a Task scheduled to a custom TaskScheduler, then even in ASP.NET Core your awaits may see a non-default context or scheduler that would lead you to want to use ConfigureAwait(false).
The text was updated successfully, but these errors were encountered:
If you’re writing general-purpose library code, use
ConfigureAwait(false)
.For more information you can read Stephen Cleary's article, ConfigureAwait FAQ
If you think ConfigureAwait(false) is no longer necessary in .NET Core or ASP.NET Core.
It's wrong.
ASP.NET Core has not own SynchronizationContext. That means that code running in an ASP.NET Core app by default won’t see a custom SynchronizationContext, which lessens the need for ConfigureAwait(false) running in such an environment.
But it doesn’t mean, however, that there will never be a custom SynchronizationContext or TaskScheduler present. If some user code (or other library code your app is using) sets a custom context and calls your code, or invokes your code in a Task scheduled to a custom TaskScheduler, then even in ASP.NET Core your awaits may see a non-default context or scheduler that would lead you to want to use ConfigureAwait(false).
The text was updated successfully, but these errors were encountered: