WaitForResult() impacting other async methods
When I call this socket.Connect() and if the WebSocket is closed with an error. There're other async methods in my code which do not return to caller method.
I peeked into the WaitForResult() method in WebSocket-sharp-core library and If I use Wait() instead of WaitForResult() or call my async methods synchronously everything works perfectly.
Also, there're no problem in further code execution if I call WebSocket.Connect() like below:
Task.Run(() =>
{
socket.Connect();
}).Wait();
Any help would be appreciated.
Can you reproduce it with the original net framework library? https://github.com/sta/websocket-sharp This repo is just a port.
If it only exists in this port, could you create a simple sample project with such behavior and describe steps to reproduce it? I'll look into it then.
//WebSocketClient.ConnectOnMainThread(); //HttpClient.SendAsync stops working WebSocketClient.ConnectOnNewThread(); //HttpClient.SendAsync works
Switch between these two statements in Program.cs and observe the behavior.
This issue doesn't seem to be there with https://github.com/sta/websocket-sharp