CSOM .NET async support
Currently, ExecuteQuery blocks the current thread and in the context of an ASP.Net application this is very resource intensive - the request thread cannot be used to service other threads whilst ExecuteQuery is waiting for a response.
ASP.Net applications only have a small number of threads proportionate to the number of cores and the lack of async support makes it very difficult to write SharePoint provider-hosted add-ins capable of handling large numbers of concurrent requests.
Thanks for your feedback! We’re happy to report that your suggestion is now part of the SharePoint Online CSOM. See more details from https://dev.office.com/blogs/new-sharepoint-csom-version-released-for-Office-365-january-2018. See the newly introduced method called Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync().
Nothing for Sharepoint 2013 On Premise ?
Jonathan Cardy commented
This is now introduced for sharepoint online....
Michael Schoen commented
I completly concurr with what Jonothan is saying, also not sure if asyn is enough to solve the "underlying" issue (ASP.NET Session Handling); I am currently fighting with an Provider Hosted Add-In (MVC) and a more complex UI where several service calls are happend in parallel...
Due to the current design (somewhat obvious) of SharePoint.Context Helper classes all those calls will happen be resolved sequentially.. That is due to the design of the underlying ASP.NET Session Handling!
I know too less about the implementation of the CSOM.NET library itself to understand if it would even support to work on the same context object across different threads... Actually I assume not.
Anyhow; the restriction, that a call to a provider hosted Add-In requires any further calls to that Add-In to wait, until the first call is resolved will make any more complex Add-Ins almost impossible to implement.