PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.69k stars 481 forks source link

Break point 'breaks debugging' when disabled during execution #1166

Open MiYanni opened 6 years ago

MiYanni commented 6 years ago

System Details

Name Value


PSVersion 5.1.16299.98 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.16299.98 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1



### Issue Description
While running a script, I remove a breakpoint. It seems that, sometimes, the debugger doesn't realize that breakpoint was removed. Steps and behavior:

1. Remove a breakpoint during a debug session while code is executing/running. (Note: Should be a breakpoint you would encounter past current execution)
2. Execution stops where the breakpoint used to be. Debugger buttons change to the 'stopped at breakpoint' state. Verbose logging shows "Hit Line Breakpoint on '######:###'" showing the line number where the breakpoint used to be. The integrated terminal allows input and shows the "[DBG]: [DBG]: " prefix before the input line.
3. At this point, trying to hit the Play button or F5 does nothing. Execution cannot resume.
4. If you hit the Stop button, the debugger UI is removed. However, the integrated console is still stuck in the debug state ("[DBG]: [DBG]: " prefix).
5. Using any options in the Debug menu (in the menu bar for VSCode) does nothing. F5 does nothing. You can no longer debug or get out of this 'zombie' debug state. The only option is kill the integrated terminal (or restart VSCode) to allow debugging again.

**Additional note**: The code this most frequently happens on is a polling process with Start-Sleep in it. I'd recommend just making a loop with a 5 to 10 second sleep between each iteration. Then, try to remove a breakpoint outside (beyond) the loop.

### Attached Logs
Let me know if you need logs for this.
SydneyhSmith commented 5 years ago

@MiYanni I am going through old issues and am wondering if you are still running into this problem with the latest version of the extension, thanks!

MiYanni commented 5 years ago

@SydneyhSmith Even though I'm on the Azure PowerShell team... I uninstalled the extension about a half a year ago. I was running into too many issues at that time (the primary one was the pane resize causing the line output to be un-readable/mangled).

Now, we've moved Azure PowerShell to PowerShell Core (6). Does this extension support PowerShell Core? If not, I probably don't have any use of re-installing it at this time. We'd definitely like to work with the team for this extension, though. We have some suggestions/ideas that would help move more customers off of PowerShell ISE. You can email me or azdevxps (team alias) if you'd like to work together.

SydneyhSmith commented 5 years ago

@MiYanni thanks for your quick reply! Yep, the extension supports Core, that is a big reason why we are trying to help users move from the ISE to VScode (so they can also move to PS Core), I will connect with you via email for more feedback.