From 4c63186f8627422c65dac9383faab25a3a832d9f Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 11 Mar 2021 11:44:32 +1100 Subject: [PATCH] Don't log or report operation cancelled exceptions --- .../Protocol/Handler/RequestExecutionQueue.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs b/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs index 4508942959f1..190eed006a57 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs @@ -228,10 +228,12 @@ private async Task ProcessQueueAsync() } } } - catch (OperationCanceledException e) when (e.CancellationToken == _cancelSource.Token) + catch (OperationCanceledException) { - // If the queue is asked to shut down between the start of the while loop, and the Dequeue call - // we could end up here, but we don't want to report an error. The Shutdown call will take care of things. + // If we're being cancelled then we shut down but logging it as an exception is misleading in the logs + // If we have shut ourselves down then calling Shutdown() here is redundant, but there is no issue calling + // it multiple times so better safe than sorry. + Shutdown(); } catch (Exception e) when (FatalError.ReportAndCatch(e)) {