pusher / pusher-websocket-dotnet

Pusher Channels Client Library for .NET
MIT License
112 stars 113 forks source link

Calling Disconnect after losing the connection results in an NRE #71

Closed cdauphinee closed 4 years ago

cdauphinee commented 5 years ago

In Connection.Disconnect, the call to _websocket.Close() invokes the socket closed event before returning. The event handler sets _disconnectionTaskComplete to null, then Disconnect continues and tries to return _disconnectTaskComplete.Task.

I'm not sure about the underlying WebSocket4Net implementation, but this will happen in any scenario where the socket closes synchronously. Connect may also have the same problem, if there's any scenario where the connection completes synchronously.

damdo commented 4 years ago

Similar issue reported in #50