SignalR/SignalR — Issue #101: Nullreference when blocking callback
Author: yvesgoeleven
Created: 2011-12-19 13:00:46+00:00
State: open

I noticed that while blocking the javascript callback thread, using a message box for example

notificationHub = $.connection.notificationHub;
notificationHub.receiveNotification = function (message) {
alert(message);
};

A null reference is thrown server side until the thread is unblocked (user clicks message box)

WebDev.WebServer40.exe Error: 0 : SignalR error during transport heart beat: System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.VisualStudio.WebHost.Connection.get_Connected()
at Microsoft.VisualStudio.WebHost.Connection.get_Connected()
at Microsoft.VisualStudio.WebHost.Request.IsClientConnected()
at System.Web.HttpResponse.get_IsClientConnected()
at System.Web.HttpResponseWrapper.get_IsClientConnected()
at SignalR.Transports.LongPollingTransport.get_IsAlive()
at SignalR.Transports.TransportHeartBeat.b__2(ITrackingDisconnect connection)
at System.Threading.Tasks.Parallel.<>c__DisplayClass32`2.b__30()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass7.b__6(Object )
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body)
at SignalR.Transports.TransportHeartBeat.Beat()
---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.VisualStudio.WebHost.Connection.get_Connected()
at Microsoft.VisualStudio.WebHost.Connection.get_Connected()
at Microsoft.VisualStudio.WebHost.Request.IsClientConnected()
at System.Web.HttpResponse.get_IsClientConnected()
at System.Web.HttpResponseWrapper.get_IsClientConnected()
at SignalR.Transports.LongPollingTransport.get_IsAlive()
at SignalR.Transports.TransportHeartBeat.b__2(ITrackingDisconnect connection)
at System.Threading.Tasks.Parallel.<>c__DisplayClass32`2.b__30()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass7.b__6(Object )