Skip to content

Breakpoints not cleaned up if Debug Interactive Session is stopped. #2371

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

Open
JustinGrote opened this issue Dec 17, 2019 · 7 comments
Open
Labels
Area-Debugging Feature: VS Code Request to use or implement a VS Code feature. Issue-Enhancement A feature request (enhancement).

Comments

@JustinGrote
Copy link
Collaborator

Issue Description

If the Interactive Debugger is started, then a breakpoint is set, but then the Interactive Debugger is then stopped, the breakpoints are still present and are not synced with the breakpoint activity bar. Further runs will still trigger debug mode even if the system currently isn't in the interactive debugger.

If PSBreakpoints are cleared when the debugger stops, this should fix it. This may be a PSES issue.

Capture

Attached Logs

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.19041
VSCode 1.42.0-insider
PowerShell Extension Version 2019.12.0

PowerShell Information

Name Value
PSVersion 5.1.19041.1
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.19041.1
BuildVersion 10.0.19041.1
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
better-align wwm 1.1.6
better-comments aaron-bond 2.0.5
better-powershell-syntax-highlighting justin-grote 0.0.2
bracket-pair-colorizer-2 CoenraadS 0.0.29
code-settings-sync Shan 3.4.3
gc-excelviewer GrapeCity 2.1.32
gistfs vsls-contrib 0.0.21
git-graph mhutchie 1.19.1
gitlens eamodio 10.2.0
indent-rainbow oderwat 7.4.0
markdown-all-in-one yzhang 2.6.1
powershell-preview ms-vscode 2019.12.0
remote-containers ms-vscode-remote 0.95.0
remote-ssh-edit-nightly ms-vscode-remote 2019.12.24000
remote-ssh-nightly ms-vscode-remote 2019.12.24000
remote-wsl ms-vscode-remote 0.41.6
todo-tree Gruntfuggly 0.0.162
vscode-icons vscode-icons-team 9.6.0
vscode-peacock johnpapa 3.2.0
vscode-sort-json richie5um2 1.18.0
vscode-zipexplorer slevesque 0.3.1
@ghost ghost added the Needs: Triage Maintainer attention needed! label Dec 17, 2019
@TylerLeonhardt
Copy link
Member

So this is a hard one because VS Code only gives us breakpoint gutter events "while debugging". That's why the Interactive Session exists. I opened a SO question to see if there's some mechanism that we can use to support this, but I think our hands are tied, unfortunately:

This is also related PowerShell/PowerShellEditorServices#1091 but kinda the opposite ask.

@TylerLeonhardt TylerLeonhardt added Area-Debugging Issue-Enhancement A feature request (enhancement). Feature: VS Code Request to use or implement a VS Code feature. and removed Needs: Triage Maintainer attention needed! labels Dec 19, 2019
@JustinGrote
Copy link
Collaborator Author

JustinGrote commented Dec 19, 2019

So is it not possible to just clear all the breakpoints in the PSES powershell instance on the "stop debugging" event? That will fix the problem.

EDIT: To be clear, clear the breakpoints within PSES but not remove them in VSCode. Then the next time the debugger starts it will just reassign them based on what is currently set in VSCode. Basically this is a PSES post-debug cleanup item, even if the debug ends "unexpectedly" e.g. stop is pressed in Interactive Mode.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Dec 19, 2019
@TylerLeonhardt
Copy link
Member

I suppose we could do that. The question is really what the expected behavior is... and how do we want to confuse the user given the limitation of VS Code.

If we clear all the breakpoints when the debugger is stopped, a user might run a script (or command from a module) directly in the PSIC that has a breakpoint set in it (clearly looking at the editor) and expect that breakpoint to be hit and the debugger to kick in.

@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Dec 19, 2019
@JustinGrote
Copy link
Collaborator Author

JustinGrote commented Dec 20, 2019 via email

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Dec 20, 2019
@JustinGrote
Copy link
Collaborator Author

JustinGrote commented Dec 20, 2019

Basically, my recommendation would be:

  1. Add a configurable option "powershell.removeBreakpointsOnStop"
  2. If configured, whenever a stop debug is triggered, send a "Get-PSBreakpoint | Remove-PSBreakpoint" to PSES.

(Sorry for the pseudo-language, I'm not great at typescript and haven't tried to delve into the actual code)

@JustinGrote
Copy link
Collaborator Author

@rjmholt @TylerLeonhardt

An alternative thought, is it possible for the extension on a pause to "re-poll" the breakpoints? That way if you had an interruption and start again, the breakpoint list would refresh and you could clean them up at that time.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Feb 4, 2020
@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Feb 4, 2020
@SydneyhSmith
Copy link
Collaborator

@JustinGrote that could be an interesting idea, let's reengage on this after our next release

@JustinGrote JustinGrote changed the title [Preview] Breakpoints not cleaned up if Debug Interactive Session is stopped. Breakpoints not cleaned up if Debug Interactive Session is stopped. Apr 22, 2020
@rjmholt rjmholt mentioned this issue Aug 24, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Debugging Feature: VS Code Request to use or implement a VS Code feature. Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

3 participants