Conflict with .Net 4.5, Task-based async and Umbraco in the same project
To correctly use Task-based async methods in .Net 4.5 you need to set the targetFramework=4.5 or aspnet:UseTaskFriendlySynchronizationContext = true
However, once you do this, you will be unable to Save media and document types in the Settings section.
This is because the ContentTypeControlNew.ascx.cs save_click event is calling new PageAsyncTask(beginHandler, endHandler, timeoutHandler, state). Unfortunately, this type of async is not fully compatible with the .Net 4.5 async and if you pass any value other than null for timeoutHandler you receive the following error:
Providing a non-null 'timeoutHandler' or a true 'executeInParallel' parameter value to the PageAsyncTask constructor is unsupported in the current application configuration. To work around this, add the following configuration switch in Web.config:
For more information, see http://go.microsoft.com/fwlink/?LinkId=252465. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Providing a non-null 'timeoutHandler' or a true 'executeInParallel' parameter value to the PageAsyncTask constructor is unsupported in the current application configuration. To work around this, add the following configuration switch in Web.config:
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Providing a non-null 'timeoutHandler' or a true 'executeInParallel' parameter value to the PageAsyncTask constructor is unsupported in the current application configuration. To work around this, add the following configuration switch in Web.config:
Conflict with .Net 4.5, Task-based async and Umbraco in the same project
To correctly use Task-based async methods in .Net 4.5 you need to set the targetFramework=4.5 or aspnet:UseTaskFriendlySynchronizationContext = true
However, once you do this, you will be unable to Save media and document types in the Settings section.
This is because the ContentTypeControlNew.ascx.cs save_click event is calling new PageAsyncTask(beginHandler, endHandler, timeoutHandler, state). Unfortunately, this type of async is not fully compatible with the .Net 4.5 async and if you pass any value other than null for timeoutHandler you receive the following error:
Providing a non-null 'timeoutHandler' or a true 'executeInParallel' parameter value to the PageAsyncTask constructor is unsupported in the current application configuration. To work around this, add the following configuration switch in Web.config:
For more information, see http://go.microsoft.com/fwlink/?LinkId=252465.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Providing a non-null 'timeoutHandler' or a true 'executeInParallel' parameter value to the PageAsyncTask constructor is unsupported in the current application configuration. To work around this, add the following configuration switch in Web.config:
For more information, see http://go.microsoft.com/fwlink/?LinkId=252465.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Providing a non-null 'timeoutHandler' or a true 'executeInParallel' parameter value to the PageAsyncTask constructor is unsupported in the current application configuration. To work around this, add the following configuration switch in Web.config:
For more information, see http://go.microsoft.com/fwlink/?LinkId=252465.]
System.Web.UI.PageAsyncTask..ctor(BeginEventHandler beginHandler, EndEventHandler endHandler, EndEventHandler timeoutHandler, Object state, Boolean executeInParallel, SynchronizationContextMode currentMode) +4402027
umbraco.controls.ContentTypeControlNew.save_click(Object sender, ImageClickEventArgs e) +309
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +134
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +204
System.Web.UI.d__14.MoveNext() +8108
is working on a reply...