Debugging breaks when a breakpoint is removed mid-execution
System Details
- Operating system name and version: Windows 7 (64-bit)
PowerShell Integrated Console
PS C:\> code -v
1.13.1
379d2efb5539b09112c793d3d9a413017d736f89
PS C:\> $pseditor.EditorServicesVersion
Major Minor Build Revision
----- ----- ----- --------
1 4 0 0
PS C:\> code --list-extensions --show-versions
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
PS C:\> $PSVersionTable
Name Value
---- -----
PSVersion 5.0.10586.117
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.117
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
When a breakpoint is removed while the debugger is active (not at a breakpoint), the debugger functionality breaks. I believe it is still hitting breakpoints but not displaying that they have been hit, and it hangs when attempting to debug again.
To reproduce:
- Open VSCode and save the script below.
$start = Get-Date
while ((New-Timespan -Start $start -end (get-date)).Seconds -lt 15) {
Write-Host "Blah!" # <-- Set a breakpoint here
Start-Sleep -Seconds 5
}
- Set a breakpoint as indicated and start debugging the script.
- When the breakpoint is hit, press F5 (continue) and remove the breakpoint before it is hit again.
After about 5 seconds, I noticed that the pause icon changed to a play icon and the "Hit Line breakpoint" message appeared in the terminal, but no breakpoint indication was present in the editor. Neither F5 or clicking the continue button resumed the script. Clicking the stop button a few times stopped the debugging. Attempting to re-run caused the debug controls to display, but debugging did not start and the execute command which usually appears in the terminal did not display.
Restarting the PowerShell session returned the debugger to normal.
Attached Logs
Thanks for filing this Dale, I think your assertion might be correct. I'll look into fixing this for the next patch update!
Deduplicating this to https://github.com/PowerShell/vscode-powershell/issues/1494