Closed andrewmd5 closed 5 years ago
Hi @Codeusa! Can you provide more details about this exception?
It seems to happen on a disconnection, if not done cleanly. Its been popping up in our exception logger.
ObjectDisposedException
Cannot access a disposed object.
Object name: 'SslStream'.
Any updates on this?
Hi @Codeusa! It is looks like generic write error. Like writing into closed socked. All I can do is provide more descriptive message.
If error is raised where it shouldn't or the behavior seems wrong then please provide more context about this error.
It is causing an uncatchable exception, which is why I reported it. It indeed seems to happen when trying to write a closed socket, but it is throwing internally and I cannot suppress it outside of the library.
I reviewed WS code and there is only three options to get exception on write: WebSocketMessageWriteRfc6455Stream.WriteAsync WebSocketMessageWriteRfc6455Stream.FlushAsync WebSocketMessageWriteRfc6455Stream.CloseAsync
Do you awaiting and catching exceptions on these?
I should mention we are still seeing this issue, even with Try Catches around all connecting/sending/receiving calls.
WebSocketException: Write operation on WebSocket stream is failed: Network connection has been closed.
Module "vtortola.WebSockets.Rfc6455.WebSocketConnectionRfc6455+<SendFrameAsync>d__43", line 907, col 0, in MoveNext
Void MoveNext()
ObjectDisposedException: Cannot access a disposed object.
Object name: 'SslStream'.
Module "vtortola.WebSockets.Rfc6455.WebSocketConnectionRfc6455+<SendFrameAsync>d__43", line 479, col 0, in MoveNext
Void MoveNext()
Module "System.Runtime.CompilerServices.TaskAwaiter", line 40, col 0, in HandleNonSuccessAndDebuggerNotification
Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
Module "System.Runtime.ExceptionServices.ExceptionDispatchInfo", line 12, col 0, in Throw
Void Throw()
Module "System.Threading.Tasks.TaskFactory`1+FromAsyncTrimPromise`1", line 2, col 0, in Complete
Void Complete(TInstance, System.Func`3[TInstance,System.IAsyncResult,TResult], System.IAsyncResult, Boolean)
Module "System.IO.Stream+<>c", line 7, col 0, in <BeginEndWriteAsync>b__53_1
System.Threading.Tasks.VoidTaskResult <BeginEndWriteAsync>b__53_1(System.IO.Stream, System.IAsyncResult)
Module "System.Net.Security.SslStream", line 0, col 0, in EndWrite
Void EndWrite(System.IAsyncResult)
Module "System.Net.Security.SslState", line 8, col 0, in get_SecureStream
System.Net.Security._SslStream get_SecureStream()
Module "System.Net.Security.SslState", line 41, col 0, in CheckThrow
Void CheckThrow(Boolean, Boolean)
Found one more place where unhanded exception could happen. Will be fixed in next version.
should be fixed in 4.2.5 exception was in WebSocketMessageWriteRfc6455Stream.Dispose()
Thank you @deniszykov!