Skip to content

Commit c8ff575

Browse files
authored
Cancel running requests when the connection terminates (#78525)
Thinking this might be the cause of some exceptions we are seeing in shutdown.
2 parents ab431e8 + 2855dc2 commit c8ff575

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/AbstractLanguageServer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ protected AbstractLanguageServer(
6565
_jsonRpc = jsonRpc;
6666
TypeRefResolver = typeRefResolver ?? TypeRef.DefaultResolver.Instance;
6767

68+
// We have no need to continue running LSP requests after the connection is closed.
69+
_jsonRpc.CancelLocallyInvokedMethodsWhenConnectionIsClosed = true;
70+
6871
_jsonRpc.AddLocalRpcTarget(this);
6972
_jsonRpc.Disconnected += JsonRpc_Disconnected;
7073
_lspServices = new Lazy<ILspServices>(() => ConstructLspServices());

0 commit comments

Comments
 (0)