Skip to content

Fix debugger regression where console needed input to start/continue #1555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ public async Task<DisconnectResponse> Handle(DisconnectArguments request, Cancel
_logger.LogInformation("Debug adapter is shutting down...");

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

return new DisconnectResponse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,6 @@ public async Task<IEnumerable<TResult>> ExecuteCommandAsync<TResult>(
}

// This is the primary reason that ExecuteCommandAsync takes a CancellationToken
cancellationToken.Register(() => shell.Stop());
return await Task.Run<IEnumerable<TResult>>(
() => shell.Invoke<TResult>(input: null, invocationSettings), cancellationToken)
.ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ public async Task<string> InvokeReadLineAsync(bool isCommandLine, CancellationTo
readLineCommand,
errorMessages: null,
s_psrlExecutionOptions,
cancellationToken).ConfigureAwait(false);
// NOTE: This command should always be allowed to complete, as the command itself
// has a linked cancellation token such that PSReadLine will be correctly cancelled.
CancellationToken.None).ConfigureAwait(false);

string line = readLineResults.FirstOrDefault();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static async Task<CommandCompletion> GetCompletionsAsync(
ILogger logger,
CancellationToken cancellationToken)
{
if (!s_completionHandle.Wait(0, cancellationToken))
if (!s_completionHandle.Wait(0, CancellationToken.None))
{
return null;
}
Expand Down