Skip to content


Subversion checkout URL

You can clone with
Download ZIP


The WebSocket instance cannot be used for communication because it has been transitioned into an invalid state. #1846

niemyjski opened this Issue · 10 comments

4 participants


I've gotten over 90 of these errors over the past week. I believe it has something to do with the client navigating away form the site? I was wondering if this is a normal error that will be thrown.

System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
 ---> System.Net.WebSockets.WebSocketException: The WebSocket instance cannot be used for communication because it has been transitioned into an invalid state.
 at System.Web.WebSockets.AspNetWebSocket.CloseOutputAsyncImpl(WebSocketCloseStatus closeStatus, String statusDescription, CancellationToken cancellationToken, Boolean performValidation)
 at System.Web.WebSockets.AspNetWebSocket.CloseOutputAsync(WebSocketCloseStatus closeStatus, String statusDescription, CancellationToken cancellationToken)
 at Microsoft.AspNet.SignalR.WebSockets.WebSocketHandler.b__3()
 at Microsoft.AspNet.SignalR.Infrastructure.TaskQueue.b__1(Func`1 next)
 at Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod[T1,TResult](Func`2 func, T1 arg)
 --- End of inner exception stack trace ---

What version of SignalR are you using? The error is normal but it should never cause an unobserved Task, that part is a bug.



We are using the latest version from NuGet:

<package id="Microsoft.AspNet.SignalR" version="1.0.1" targetFramework="net45" />
<package id="Microsoft.AspNet.SignalR.Core" version="1.0.1" targetFramework="net45" />
<package id="Microsoft.AspNet.SignalR.JS" version="1.0.1" targetFramework="net45" />
<package id="Microsoft.AspNet.SignalR.Owin" version="1.0.1" targetFramework="net45" />
<package id="Microsoft.AspNet.SignalR.Redis" version="1.0.0-rc3" targetFramework="net45" />
<package id="Microsoft.AspNet.SignalR.SystemWeb" version="1.0.1" targetFramework="net45" />

Can you reproduce the error? Are you running on .NET 4 or .NET 4.5?


.NET 4.5 and I'm trying to reproduce under the debugger as we speak. Our error reporting service ( is where I first came across this exception and now it's our highest occurring exception.


Looks like a bug in our websocket close. We need to observe the exception so those errors don't show up.

@davidfowl davidfowl was assigned

Moving to 1.1 RTW.


Thanks, any rough estimate on when that will be available? Or when I could deploy/test a stable version to stage/prod?


You can get a rough estimate of our release from the milestones Other than I have no estimate for you. Keep watching the bug until its fixed. After that you can use a nightly build (unsupported for production use) if you want.



@Xiaohongt Xiaohongt was assigned

verified TaskAsyncHelper.Catch() is logging the exception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.