-
Notifications
You must be signed in to change notification settings - Fork 513
Breakpoints set in UI while script is running are never hit #854
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
Comments
Hmmm, I don't think PowerShell allows you to call Set-PSBreakpoint while execution is running, or at least the PowerShell ISE explicitly disallows it. I could be wrong about that, though. |
PowerShell itself allows setting breakpoints while running. Try this script in a usual console: # just out of curiosity
[runspace]::DefaultRunspace.Debugger.add_BreakpointUpdated({
Write-Host ($_ | Out-String)
})
Set-PSBreakpoint -Variable test
$test = 1 # breaks into the debugger BTW, I looked for |
I would have sworn that I used to be able to start DebugTest.ps1 in the debugger, then set a breakpoint and it would stop. |
Can't reproduce. Tested with this script and let it run for a couple of iterations, and then set breakpoint while still running and it triggered.
Tested on VSCode 1.44.1 with Powershell extension 2020.3.0. Tested on both PS7 and PS5.1. |
Just as a note, due to the way we're forced to implement this in PS 5.1, it's likely some form of this will always exist in 5.1. See #1494. In PS 7, an API was added that allows us to add breakpoints concurrently to script execution, meaning this is solved there. |
System Details
Issue Description
Open the Examples folder and then open DebugTest.ps1. Set debug config to launch the current file then press F5. Before the script terminates, set a breakpoint on line 12. This used to work i.e. on the next iteration through the loop the newly set breakpoint would be hit. Now it is not.
I think I also was able to set the breakpoint in the UI while the script was running (didn't hit it) and was able to unset it before the script stopped. On the next iteration, the breakpoint was hit even though it appeared to be removed. After that my debugger got into a hung state.
Attached Logs
Follow the instructions in the README
about capturing and sending logs.
1497062619-9642196a-f1c8-435c-803d-50e4d7d5ce701497062616431.zip
The text was updated successfully, but these errors were encountered: