Support asynchronous child actions
Attempting to use a child action that's marked as "async" in its method declaration results in the error message "HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete.".
The lack of support for asynchronous child actions makes it extremely easy to deadlock .NET 4.5 code. For example, assume the child action makes a call to an 'async' function. Since the child action can't use async as well, it's forced to "Wait" on the async task and block synchronously.
By default, async methods attempt to use the synchronization context - which is blocked. This means that child actions calling asynchronous code will deadlock when developed in a trivial, standard sort of way.
Of course, the "await" calls in the async method can be set to "ConfigureAwait(false)", but only if the developer has access to the library's source code. If a third party library is used, they may use the default await syntax and ASP.NET will deadlock with absolutely no workarounds to the problem.
Definitely need support for async child actions to work around this problem. All of the Microsoft Gurus in the async team say over and over "never block on an async task" - yet MVC 4 requires us to.
2 comments
-
Luca Milan
commented
Very good idea!
-
Ben Foster
commented
A big +1!. In our ASP.NET MVC application we use a custom Action Filter to controller actions to be called normally or via Html.Action. Without support for asynchronous child actions we are going to have to create non-async versions of all of these controller actions.