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

Unhandled Exception in WebSocket4Net.WebSocket.OnConnected() at 0.15.2 #204

Open
jercymat opened this issue Nov 8, 2024 · 0 comments
Open

Comments

@jercymat
Copy link

jercymat commented Nov 8, 2024

System: Windows Server 2022
Library Version: 0.15.2.11

Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
   at WebSocket4Net.Protocol.DraftHybi10Processor.SendHandshake(WebSocket4Net.WebSocket)
   at WebSocket4Net.WebSocket.OnConnected()
   at WebSocket4Net.WebSocket.client_Connected(System.Object, System.EventArgs)
   at SuperSocket.ClientEngine.ClientSession.OnConnected()
   at SuperSocket.ClientEngine.AsyncTcpSession.OnGetSocket(System.Net.Sockets.SocketAsyncEventArgs)
   at SuperSocket.ClientEngine.TcpClientSession.ProcessConnect(System.Net.Sockets.Socket, System.Object, System.Net.Sockets.SocketAsyncEventArgs, System.Exception)
   at SuperSocket.ClientEngine.ConnectAsyncExtension.SocketAsyncEventCompleted(System.Object, System.Net.Sockets.SocketAsyncEventArgs)
   at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(System.Net.Sockets.SocketAsyncEventArgs)
   at System.Net.Sockets.SocketAsyncEventArgs.ExecutionCallback(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(System.Net.Sockets.SocketError, Int32, System.Net.Sockets.SocketFlags)
   at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)

Our app crashed due to the unhandled exception. Seems like the exception occurred here:

ProtocolProcessor.SendHandshake(this);

#80 have the similar issue and a simple exception handling might work just like it did here:
try
{
ProtocolProcessor.SendCloseHandshake(this, statusCode, reason);
}
catch (Exception e)
{
if (Client != null)
{
OnError(e);
}
}

As the new 1.x.x version didn't support .NET framework, a fix on this version would be great:)

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

No branches or pull requests

1 participant