Skip to content

Commit a59629e

Browse files
committed
Fix erroneous cancellation tokens
These needed to be explicitly `None` to indicate that they should not be cancelled (for various reasons).
1 parent e1da50e commit a59629e

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/PowerShellEditorServices/Services/DebugAdapter/Handlers/DisconnectHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ public async Task<DisconnectResponse> Handle(DisconnectArguments request, Cancel
7474
_logger.LogInformation("Debug adapter is shutting down...");
7575

7676
#pragma warning disable CS4014
77-
// Trigger the clean up of the debugger. No need to wait for it.
78-
Task.Run(_psesDebugServer.OnSessionEnded, cancellationToken);
77+
// Trigger the clean up of the debugger. No need to wait for it nor cancel it.
78+
Task.Run(_psesDebugServer.OnSessionEnded, CancellationToken.None);
7979
#pragma warning restore CS4014
8080

8181
return new DisconnectResponse();

src/PowerShellEditorServices/Services/PowerShellContext/Session/PSReadLinePromptContext.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ public async Task<string> InvokeReadLineAsync(bool isCommandLine, CancellationTo
144144
readLineCommand,
145145
errorMessages: null,
146146
s_psrlExecutionOptions,
147-
cancellationToken).ConfigureAwait(false);
147+
// NOTE: This command should always be allowed to complete, as the command itself
148+
// has a linked cancellation token such that PSReadLine will be correctly cancelled.
149+
CancellationToken.None).ConfigureAwait(false);
148150

149151
string line = readLineResults.FirstOrDefault();
150152

src/PowerShellEditorServices/Services/Symbols/Vistors/AstOperations.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static async Task<CommandCompletion> GetCompletionsAsync(
6262
ILogger logger,
6363
CancellationToken cancellationToken)
6464
{
65-
if (!s_completionHandle.Wait(0, cancellationToken))
65+
if (!s_completionHandle.Wait(0, CancellationToken.None))
6666
{
6767
return null;
6868
}

0 commit comments

Comments
 (0)