4 ms·
I actually have no idea if it still applies, but I haven't seen code that uses it for a long time. Maybe it was important for desktop apps?
by serguzest 4y ago
I actually have no idea if it still applies, but I haven't seen code that uses it for a long time. Maybe it was important for desktop apps?
- avsteele 4y agoIt's important to have ConfigureAwait(true) (the default) any time you need the continuation to be on the same thread. This is used/needed for many UI frameworks (WPF), which is why it is the default. Otherwise you should use (false) for performance reasons.
- foepys 4y agoYes, this is very important. I experienced deadlocks in ASP.NET Core 2.1 when I connected a legacy application to the web with it and the developers of Microsoft.AspNetCore.Mvc.Formatters.Json forgot to add .ConfigureAwait(false) to a async call into Newtonsoft.Json. This was easily fixed by writing a small warper around the JsonInputFormatter but it shows how important ConfigureAwait is. When writing a library for anything netstandard, always put ConfigureAwait(false) after each async call where it is not mandatory to return to the same thread again.
- SideburnsOfDoom 4y ago> It's important to have ConfigureAwait(true) ... Otherwise you should use (false) This is not universal. In modern ASP.NET core (i.e. web services), ConfigureAwait does nothing and is not recommended. I can confidently say that I don't want it in any of the code that I work on. We can make blanket statements, but clearly we do different things using different patterns and one size does not fit all. https://stackoverflow.com/questions/42053135/configureawaitfalse-relevant-in-asp-net-core https://stackoverflow.com/questions/42053135/configureawaitf...