Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I'm getting the following error on a page using Umbraco forms.
[InvalidOperationException: The asynchronous action method 'Index' returns a Task, which cannot be executed synchronously.] System.Web.Mvc.Async.TaskAsyncActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +115 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 System.Web.Mvc.<>c__DisplayClass24_0.<InvokeActionMethodWithFilters>b__0() +55 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253 System.Web.Mvc.<>c__DisplayClass24_1.<InvokeActionMethodWithFilters>b__2() +22 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253 System.Web.Mvc.<>c__DisplayClass24_1.<InvokeActionMethodWithFilters>b__2() +22 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253 System.Web.Mvc.<>c__DisplayClass24_1.<InvokeActionMethodWithFilters>b__2() +22 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +190 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +521 System.Web.Mvc.Controller.ExecuteCore() +95 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +180 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 Umbraco.Web.Mvc.UmbracoPageResult.ExecuteControllerAction(ControllerContext context, IController controller) +75 Umbraco.Web.Mvc.UmbracoPageResult.ExecuteResult(ControllerContext context) +297
I get it on submit of the form and, if I have multiple form pages, using the next button.
Not sure where to start really. Any ideas?
Did you get anywhere with this? Im getting it when Im implementing custom validation on forms
I'm having the same problem with a custom form (not umbraco forms).
From my understanding what is happening is that you cannot use an async [HttpGet] controller method if you want to use return CurrentUmbracoPage() as the latter is sync.
What you could do is transform the async GET method to a sync one but that would open another can of worms since awaiting async stuff inside a sync method is dangerous and can end up in deadlocks: https://stackoverflow.com/questions/9343594/how-to-call-asynchronous-method-from-synchronous-method-in-c
I bypassed the problem altogheter using an ajax call avoiding the 'return CurrentUmbracoPage()'...
But I'm curious if there is a more idiomatic way to resolve the problem...
Ive noticed there is a setting in the config to make the workflow calls async, havnt played with it yet though
<setting key="ExecuteWorkflowAsync" value="False"/>
https://our.umbraco.com/documentation/Add-ons/umbracoforms/developer/Configuration/#executeworkflowasync
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Umbraco Forms Error - The asynchronous action method 'Index' returns a Task, which cannot be executed synchronously
Hi
I'm getting the following error on a page using Umbraco forms.
I get it on submit of the form and, if I have multiple form pages, using the next button.
Not sure where to start really. Any ideas?
Did you get anywhere with this? Im getting it when Im implementing custom validation on forms
I'm having the same problem with a custom form (not umbraco forms).
From my understanding what is happening is that you cannot use an async [HttpGet] controller method if you want to use return CurrentUmbracoPage() as the latter is sync.
What you could do is transform the async GET method to a sync one but that would open another can of worms since awaiting async stuff inside a sync method is dangerous and can end up in deadlocks: https://stackoverflow.com/questions/9343594/how-to-call-asynchronous-method-from-synchronous-method-in-c
I bypassed the problem altogheter using an ajax call avoiding the 'return CurrentUmbracoPage()'...
But I'm curious if there is a more idiomatic way to resolve the problem...
Ive noticed there is a setting in the config to make the workflow calls async, havnt played with it yet though
https://our.umbraco.com/documentation/Add-ons/umbracoforms/developer/Configuration/#executeworkflowasync
is working on a reply...