Skip to content

Commit beb5ca7

Browse files
authored
2 parents f3ecd54 + 1b88ccb commit beb5ca7

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using System.Reflection;
1313
using System.Threading;
1414
using System.Threading.Tasks;
15+
using Microsoft.VisualStudio.Threading;
1516
using StreamJsonRpc;
1617

1718
namespace Microsoft.CommonLanguageServerProtocol.Framework;
@@ -326,18 +327,21 @@ private ValueTask ShutdownRequestExecutionQueueAsync()
326327
return queue.DisposeAsync();
327328
}
328329

329-
#pragma warning disable VSTHRD100
330330
/// <summary>
331331
/// Cleanup the server if we encounter a json rpc disconnect so that we can be restarted later.
332332
/// </summary>
333-
private async void JsonRpc_Disconnected(object? sender, JsonRpcDisconnectedEventArgs e)
333+
private void JsonRpc_Disconnected(object? sender, JsonRpcDisconnectedEventArgs e)
334334
{
335-
// It is possible this gets called during normal shutdown and exit.
336-
// ShutdownAsync and ExitAsync will no-op if shutdown was already triggered by something else.
337-
await ShutdownAsync(message: "Shutdown triggered by JsonRpc disconnect").ConfigureAwait(false);
338-
await ExitAsync().ConfigureAwait(false);
335+
JsonRpc_DisconnectedAsync(sender, e).Forget();
336+
337+
async Task JsonRpc_DisconnectedAsync(object? sender, JsonRpcDisconnectedEventArgs e)
338+
{
339+
// It is possible this gets called during normal shutdown and exit.
340+
// ShutdownAsync and ExitAsync will no-op if shutdown was already triggered by something else.
341+
await ShutdownAsync(message: "Shutdown triggered by JsonRpc disconnect").ConfigureAwait(false);
342+
await ExitAsync().ConfigureAwait(false);
343+
}
339344
}
340-
#pragma warning disable VSTHRD100
341345

342346
internal TestAccessor GetTestAccessor()
343347
{

0 commit comments

Comments
 (0)