In the last couple of weeks we received cases where customers enabled ASP.NET task friendly synchronization in the web.config of their SharePoint servers using web.config entries like the following:
<appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> </appSettings>
If this key value is set to false [default], asynchronous code paths in ASP.NET 4.5 behave as they did in ASP.NET 4.0. If this key value is set to true, ASP.NET 4.5 uses code paths that are optimized for Task-returning APIs. Setting this compatibility switch is mandatory for WebSockets-enabled applications, for using Task-based asynchrony in Web Forms pages, and for certain other asynchronous behaviors.
Be aware that SharePoint does not support this setting on SharePoint versions and patch levels older than SharePoint Server 2019 with May 2019 CU.
Customers running SharePoint Server 2013 and SharePoint Server 2016 need to upgrade to SharePoint Server 2019 if their customizations require this setting.
Customers running SharePoint Server 2019 need to apply May 2019 CU.