diff --git a/src/Client/LanguageClient.cs b/src/Client/LanguageClient.cs index 22c7004df..8c05daa8c 100644 --- a/src/Client/LanguageClient.cs +++ b/src/Client/LanguageClient.cs @@ -423,7 +423,16 @@ public async Task Shutdown() { if (_connection.IsOpen) { - await this.RequestShutdown().ConfigureAwait(false); + try + { + // this can get stuck forever, so use a timeout. + var cancelSource = new CancellationTokenSource(); + cancelSource.CancelAfter(5 * 1000); + + await this.RequestShutdown(cancelSource.Token).ConfigureAwait(false); + } + catch (TaskCanceledException) { } + this.SendExit(); }