Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix async operation issue when used in ASP.NET #28

Merged
merged 1 commit into from
Jul 4, 2016

Conversation

dil-spayne
Copy link
Contributor

Issue:
Changing SendPacket to an async void method caused the following when used in an ASP.NET MVC application

System.InvalidOperationException: An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked <%@ Page Async="true" %>. This exception may also indicate an attempt to call an "async void" method, which is generally unsupported within ASP.NET request processing. Instead, the asynchronous method should return a Task, and the caller should await it.

Resolution:
Wait for the WaitForUpgrade task to complete synchronously and remove the async modifier from SendPacket.

Note:
The alternative to synchronously waiting is to propagate the async/await pattern up through all methods that call SendPacket, this is a much larger change than I am comfortable making at this point in time.

@mattqs mattqs merged commit 30b1903 into Quobject:master Jul 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants