From 0158854075c9e76b79bc63ca2980891821da6ad8 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Tue, 26 Apr 2022 12:21:35 -0700 Subject: [PATCH] Don't cancel on disposal of `CancellationScope` --- .../Services/PowerShell/Utility/CancellationContext.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PowerShellEditorServices/Services/PowerShell/Utility/CancellationContext.cs b/src/PowerShellEditorServices/Services/PowerShell/Utility/CancellationContext.cs index daee301ba..10dba79a3 100644 --- a/src/PowerShellEditorServices/Services/PowerShell/Utility/CancellationContext.cs +++ b/src/PowerShellEditorServices/Services/PowerShell/Utility/CancellationContext.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; @@ -109,8 +109,10 @@ internal CancellationScope( public void Dispose() { + // TODO: This is whack. It used to call `Cancel` on the cancellation source, but we + // shouldn't do that! + _cancellationSource.Dispose(); _cancellationStack.TryPop(out CancellationScope _); - _cancellationSource.Cancel(); } } }