Debugging with active breakpoint crashes Powershell session
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 am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
Summary
Powershell session crashes in preview extension when attempting to debug a script with active breakpoint in unsaved file. Debugging the same code in a saved file works.
Also occurs when debugging Pester tests, but was able to reproduce the same exception in this simpler demo so I believe it might be the same root cause.
PowerShell Version
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
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.62.0-insider
b3318bc0524af3d74034b8bb8a64df0ccf35549a
x64
Extension Version
ms-vscode.powershell-preview@2021.11.0
Steps to Reproduce
- Open a new unsaved file with content
$a = 1
- Place a breakpoint on the line and launch/debug file as normal
Visuals
Repro
Exception
Logs
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:20 (3 by maintainers)
Top Results From Across the Web
Debugging PowerShell script in Visual Studio Code – Part 1
In the first of this two-part series, we will cover the many features of the PowerShell debugger for Visual Studio Code. These features...
Read more >Debug using the Just-In-Time Debugger - Visual Studio
If you once had Visual Studio installed, you may need to disable Just-In-Time debugging from the Windows registry. Enable or disable Just-In- ...
Read more >Attach to running processes with the Visual Studio debugger
Discover how to attach the Visual Studio debugger to a running process on a local or remote computer.
Read more >How to Debug Scripts in Windows PowerShell ISE
You can set three types of breakpoints in the Windows PowerShell debugging environment: Line breakpoint. The script pauses when the designated ...
Read more >Debugging PowerShell Scripts in Visual Studio Code - YouTube
In this video, I show how to use the PowerShell Extension for Visual Studio Code to debug PowerShell scripts. We'll look at how...
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
I can consistently reproduce if you:
I get the same scopes issue. Doesn’t happen if you don’t have a debug session started.
Agreed, @andschwa there should be a broad catch for all otherwise-uncaught pwsh invocation exceptions that logs the exception occurred but doesn’t kill PSES (or at the very worst auto-restarts it)