Skip to content
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

Debugger hangs when you press stop while an input prompt is active #428

Closed
rkeithhill opened this issue Apr 7, 2017 · 3 comments
Closed
Labels
Issue-Bug A bug to squash.
Milestone

Comments

@rkeithhill
Copy link
Collaborator

This is with PSES 0.12.1 and VSCode 1.11.0. Try this. Open a file and put in Remove-Item. This will prompt you for a path to remove. Stop debugging before replying to the prompt in the console. The debugger appears to stop but if you try to debug again, it doesn't start debugging.

@daviwil
Copy link
Contributor

daviwil commented Apr 7, 2017

Cool, I'll take a look tonight. Aborting the execution should cancel the prompt, but maybe I lost that behavior with the integrated console changes

@daviwil daviwil modified the milestones: 1.0, April 2017 Apr 7, 2017
@daviwil daviwil added the Issue-Bug A bug to squash. label Apr 7, 2017
@daviwil
Copy link
Contributor

daviwil commented Apr 7, 2017

Seems like there's a larger problem here where input prompts can't be cancelled via code, only through the integrated console. I believe this was caused by my change to using Console.ReadKey synchronously on a background thread. I think it's going to require a loop to check the state of the cancellation token while waiting for the string to be read on a different thread. Not a huge change, but it'll require some testing. Might have to hold off until the next update.

@daviwil daviwil changed the title Stop debugging a command that isn't supplied with all mandatory parameters, hangs debugger Debugger hangs when you press stop while an input prompt is active Apr 7, 2017
daviwil added a commit to daviwil/PowerShellEditorServices that referenced this issue Apr 7, 2017
This change enables the cancellation of input prompts by calling a
function rather than using Ctrl+C in the console.  This is necessary in
cases like stopping the debugger where an active input prompt can cause
the debugger to hang if it can't be cancelled.  The fix is to be more
reactive to the abort of command execution so that the active input
prompt can be cancelled.

Resolves PowerShell#428.
@daviwil
Copy link
Contributor

daviwil commented Apr 7, 2017

Current work is here: daviwil@d3c440f

daviwil added a commit to daviwil/PowerShellEditorServices that referenced this issue May 9, 2017
This change fixes an issue where the debugger will hang when the user
tries to stop execution while there is an active input or choice prompt.
The solution is to use a more robust method for cancelling the prompt
task which doesn't depend on the Console.ReadKey() call to return.

Fixes PowerShell#428.
@daviwil daviwil closed this as completed in b2e4598 May 9, 2017
@daviwil daviwil modified the milestones: May 2017, 1.0.0-beta.1 May 9, 2017
TylerLeonhardt pushed a commit to TylerLeonhardt/PowerShellEditorServices that referenced this issue Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

2 participants