Debugger won't run until `ENTER` is pressed in integrated console
See original GitHub issuePrerequisites
- I have written a descriptive issue title.
- I have searched all issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
Summary
This is currently only happening with v2021.8.1-preview (the PowerShell Preview extension) and PowerShell 7, but it happens on Windows and macOS. @SeeminglyScience confirmed for me: run any PowerShell script in the debugger, it won’t actually do anything (like run to a breakpoint or completion) until you manually go to the integrated console and press ENTER
.
PowerShell Version
Name Value
---- -----
PSVersion 7.1.4
PSEdition Core
GitCommitId 7.1.4
OS Microsoft Windows 10.0.22000
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visual Studio Code Version
1.59.1
3866c3553be8b268c8a7f8c0482c0c0177aa8bfa
x64
Extension Version
ms-vscode.powershell-preview@2021.8.1
Steps to Reproduce
- Run PowerShell script in debugger
- It hangs until
ENTER
is sent
Visuals
No response
Logs
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
VSCode - cannot enter input into console while debugging C++
I am trying to debug a single C++ file on Visual Studio Code on Windows. Running and debugging works fine. However, when I...
Read more >Not able to capture user input on internal terminal when ...
Now debug any java file which accepts user inputs. VS Terminal won't be able to capture those inputs. Note: External console i.e. cmd...
Read more >Debugging in Visual Studio Code
To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and...
Read more >Code Running Assistance | PyCharm Documentation - JetBrains
Each script or test you wish to run or debug from within PyCharm, needs a special profile that specifies the script name, working...
Read more >Debugging in the browser - The Modern JavaScript Tutorial
Console. If we press Esc , then a console opens below. We can type commands there and press Enter to execute. After a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Haha, oops, our bad. @rjmholt and I added the
Stop()
registration at the last minute. That explains why this was only in 2.4.8 and not 2.4.7.@andschwa I think it’s this:
https://github.com/PowerShell/PowerShellEditorServices/blob/6a19daf5bc3e8547fbdc10f351ac2a81d76f9cec/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs#L768
Linked cancellation token sources work by essentially registering a cancellation handler on the target token. I’m guessing the handlers are invoked sequentially on the same thread, and if that’s the case then the link handler will never fire because
shell.Stop
won’t finish. The pipeline won’t stop untilReadLine
returns, andReadLine
won’t return until the next cancel handler fires.Might get away with just changing it to
shell.BeginStop()