A different exception (NullRefereceException) on SendHandSake

Oct 19, 2012 at 4:10 PM

System.NullReferenceException: Object reference not set to an instance of an object.   at WebSocket4Net.Protocol.DraftHybi10Processor.SendHandshake(WebSocket websocket)   at WebSocket4Net.WebSocket.OnConnected()   at WebSocket4Net.WebSocket.client_Connected(Object sender, EventArgs e)   at SuperSocket.ClientEngine.ClientSession.OnConnected()   at SuperSocket.ClientEngine.SslStreamTcpSession.OnAuthenticated(IAsyncResult result)   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)   at System.Net.Security.SslState.FinishHandshake(Exception e, AsyncProtocolRequest asyncRequest)   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)   at System.Net.Security.SslState.ReadFrameCallback(AsyncProtocolRequest asyncRequest)   at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)   at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)   at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)   at System.Net.LazyAsyncResult.Complete(IntPtr userToken)   at System.Net.ContextAwareResult.CompleteCallback(Object state)   at System.Threading.ExecutionContext.runTryCode(Object userData)   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)   at System.Net.ContextAwareResult.Complete(IntPtr userToken)   at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)   at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

Thanks.

Oct 22, 2012 at 3:15 AM

I saw this exception when the laptop comes back from hibernation.  It does not happen all the time. Do you have a fix for this exception?

Coordinator
Oct 22, 2012 at 3:23 AM

I'll check this exception.

Oct 23, 2012 at 3:51 PM

That would be great.  Please let me know when you plan to check in the fix.  At the mean time, is there anything I can do in my code to catch the exception or avoid it.

 

Thank you for your great support.

 

Coordinator
Oct 28, 2012 at 4:50 AM

Is your application a Silverlight one or other type?

Coordinator
Oct 28, 2012 at 5:15 AM

Could you try to use debug version with PDB? Then you can get the line number of the exception code.

Oct 29, 2012 at 2:22 PM

It is .net 4.0.   Yes, I can try that.  I added a try-catch block around SendHandshake method to catch the exception.   It seems to work well.  But I will try the debug version and let you know.