potential downside of setting UseTaskFriendlySynchronizationContext=true


ASP.Net applications originally created under .NET 4.0 and later ported to .NET 4.5 in Visual Studio will still run using the legacy ASP pipeline unless you remember to add one of these to your web.config:

<add key="UseTaskFriendlySynchronizationContext" value="true"/>


<httpRuntime targetFramework="4.6.1" />

I have a couple of question here:
  • if neither of these settings are present, but if I have recompiled my application as a .NET 4.5 (say) project and used new classes like System.Web.HttpClient, is my application running under .NET 4.0, .NET 4.5, or some hybrid environment?
  • I know there are some nasty deadlocks that can happen if I use the legacy ASP pipeline, call an async method like HttpClient.SendAsync(), and block on the result with Task.Result() or something similar. But are there any risks to taking an application that is (seemingly) working ok and adding either of the two settings mentioned above? I'm interested in the specific risks associated with each setting, and how to assess them based on the characteristics of my application.