-
Notifications
You must be signed in to change notification settings - Fork 151
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
Stabilize Dispose patterns #246
Comments
I've re-opened microsoft/vs-threading#105 where we might place the fix for no. 2 above. |
Fixes part of microsoft#246
No. 2 above is indeed resolved by microsoft/vs-threading#493 |
This would be very useful. We need to get to a state when remote calls can only throw 4 types of exceptions that correspond to
Also, when a connection is dropped and |
Everything checks out, but this resolves a concern brought up in microsoft#246
Co-authored-by: Andrew Arnott <andrew.arnott@microsoft.com>
Customers have reported a few times that they want to Dispose of JsonRpc (or indirectly its
MessageHandlerBase
):Disconnected
event handlerWe know that disposing the
MessageHandlerBase
while messages are being transmitted is very problematic (e.g. dotnet/roslyn#18563).And I suspect disposing from our event handler has undefined behavior.
AsyncSemaphore
inMessageHandlerBase.Dispose
. There are no native resources to release, and this would avoid random exception types being thrown on our transmission thread, sometimes leading to crashes. Instead, we can set a boolean field so that any future transmission request is denied with anObjectDisposedException
.Also: when is
ObjectDisposedException
thrown compared toConnectionLostException
? EvenOperationCanceledException
can be thrown back to pending requests due to a disconnection.The text was updated successfully, but these errors were encountered: