I would like to know if .Net 5 based ASP.Net applications still has no SynchronizationContexts as mentioned here so I can continue to not write ConfigureAwait(false)
or should I start sprinkling it all over?
No, ASP.NET does not have a sync-context any more, and is extremely unlikely to ever regain one without a huge fight. You could verify this yourself by testing whether SynchronizationContext.Current
has a value.
That said, if you're writing application level code, if there was a sync-context, you probably shouldn't be suppressing it; only library code should usually suppress sync-context, and library code should probably not make assumptions about the host environment, meaning: in library code you should probably add ConfigureAwait(false)
manually if you don't want sync-context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With