-
Notifications
You must be signed in to change notification settings - Fork 491
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
VS Code Powershell debugger hanging - PS 7 with Powershell extension #3415
Comments
I'm having a very similar issue, but the debugger never hits the first breakpoint and I'm using PS 5.1. It shows the toolbar (screenshot below), but never hits the breakpoint and the terminal hangs - can't scroll or type. Simple Script
Logs Code Version
Extensions
Editor Services Version
PSVersion Table
UPDATE |
Not sure if it matters, but highlighting code and pressing F8 runs that section of code without issue. |
Hey, just an FYI we are actively working on PowerShell/PowerShellEditorServices#1295 which re-wires the debugger. Hence we are prioritizing that rather than fixing issues with the existing implementation. We intend to have that in the next preview, and then we will see if this problem goes away 😄 |
@strickdd - @andschwa - Any target release date for the new debugger? I read through the referenced thread and saw a mentioned target date of EOY 2020, which obviously is no longer accurate. |
The whole year of 2020 was...a mess, for everyone (also I was not yet a maintainer here). We are planning to get it into the next release, hopefully end of this month, potentially next month, but not much later than that! |
@andschwa - Thank you for the update. I suppose I can work around this issue for now. Regards. |
The problem might be connected to PSReadline v2.2.0-Beta3 (reported in PowerShell/PSReadLine#2616) |
If that is the case, could @peetrike and @bkarlow-optimo try ensuring you only have PSReadLine 2.1.0 on the machine? I will try to prioritize this: PowerShell/PowerShellEditorServices#1493 |
I am only on version 2.1.0. See below: PS C:> Get-Module PSReadline -ListAvailable
ModuleType Version PreRelease Name PSEdition ExportedCommands Script 2.1.0 PSReadLine Desk {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption…}
ModuleType Version PreRelease Name PSEdition ExportedCommands Script 2.0.0 beta2 PSReadline Desk {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption…} |
This was indeed my issue. I removed the PSReadline v2.2.0-Beta3 and now it is working properly. |
Uninstalling PSReadline v2.2.0-Beta3 fixed my issue with the debugger hanging also. |
I'm dropping a new Preview of the release this week that will only use the bundled version of PSReadLine, and so should avoid this issue entirely! |
@thomglow Can you try the 2021.7.0-preview version ("PowerShell Preview") on the marketplace, install PSReadLine v2.2.0-beta3 on your machine, and verify that this issue is fixed? The preview extension has logic now that only loads the bundled PSReadLine 😁 |
@andschwa I did test mine without the beta of PSReadLine and it still hangs for me. I will get some more information here shortly and edit this post. PS L:\powershell> code -v 1.58.2 PS L:\powershell> code --list-extensions --show-versions [email protected] PS L:\powershell> $psEditor.EditorServicesVersion Major Minor Build Revision 2 4 6 0 PS L:\powershell> $PSVersionTable Name Value PSVersion 7.1.3 |
Oops, actually I mean @hemingsent, whose issues did have to do with PSReadLine beta3. I think your issue is different. |
the 2021.7.0-preview works with PSReadLine v2.2.0-beta3. Debugger starts and works normally |
Yay, thank you! |
I'm going to leave this issue open as @bkarlow-optimo original reported issue is, to my knowledge, unrelated to the PSReadLine beta3 incompatibility issue. |
Just installed 2021.7.0-preview with PSReadLine v2.2.0-beta3 and tested. Debugger hangs for me still. The debug toolbar comes up, but the breakpoint is never hit. I'm using PS 5.1. The terminal locks up and has to be killed/restarted to interact with it again. It looks like PSReadline 2.1.0 was loaded initially so I removed that and manually loaded PSReadline 2.2.0. After manually loading 2.2.0, I run and get an error in the PowerShell Editor Services log (below). The weird thing is that it mentions "untitled:Untitled-2", but the file I'm trying to debug is "GroupMembershipRecurseWithCreds.ps1". I'm happy to run any additional tests or provide additional details.
|
Sounds like your issue @strickdd is also (unfortunately) not the PSReadLine issue. |
I am the co-developer of https://github.com/Minerx117/NemosMiner/tree/testing and I've got a slightly different problem with the debugger which might be related. Executing
breaks the debugger - the breakpoint gets hit, but the relevant code will not get highlighted. Sample code to reproduce the problem:
Latest working combo: Upgrading pwsh to -preview7 or later breaks the debugger Any ideas? |
Yes, we seem to have a number of issues right now around the use of |
I am pleased to help - can you give exact instructions? |
I have same issue.
After breakpoint (line 2) gets hit, pressing F10 reproduces a problem (debugger does not highlight anything and hungs). If you then hit F11 - script continues (writes "OK" to host) but debugger hungs anyway. Update: I've rolled back to version 1.51.1 of Visual Studio and it works now. |
@UselessGuru Your script has been quite useful, I spent yesterday debugging! I've got things a little more stable (you can now exit the debugger even after it "hangs" at that breakpoint, which didn't seem to be working at first). It's perhaps a little painful to get this debugged, you end up with three concurrent debugging sessions. Before getting to that point, if you're interested, you can get setup just debugging PSES and the extension following these instructions. |
See also: #2352 |
@UselessGuru @AfanasievAA (and anyone else with issues debugging a PowerShell script which uses an object from @bkarlow-optimo is your issue the same as theirs, or separate? |
I've quick tested it. It works! No more debugger fails. Used Visual Studio Code 1.60.0 insider (x64) with your extension. Thanx for fixing it! ) |
I've quick tested it. It works! VSC 1.59 & PWSH 7.2-Preview8 |
Hooray! It might be a bit to get this fix into a proper release. The bug was in OmniSharp, so I'll need to get a PR accepted into that library, get them to do a release, and then pull that into PSES and the extension. But it's solved 🥳 |
@bkarlow-optimo and @strickdd I'm not certain your issues were the same root cause, but would you test the dev build posted in #3394 (comment) so I know? |
Since my best guess is that this was related to the threading issues within PSES and OmniSharp, and since those are now fixed and merged, I'm going to mark this issue as resolved. Please wait for the next update to the extension to roll out (no later than Monday) and see if this has been fully resolved for you. If not, since this thread got long and covered several problems, please open a new issue. |
This issue has been marked as fixed. It has been automatically closed for housekeeping purposes. |
Issue Description
I am experiencing a problem with... VSCode debugger with Powershell integrated console set to Powershell Core version 7.1.3. The debugger launches, finds the first breakpoint in the entry point PS1 script file, executes to the first breakpoint - all good.
Immediately upon stepping over the breakpoint (F10), debugger hangs, terminal is non-responsive.
This MAY be related to #3410 , but unclear.
This is reproduceable.
VS Code settings:
{
"powershell.powerShellAdditionalExePaths": [
{
"exePath": "C:\Program Files\PowerShell\7\pwsh.exe",
"versionName": "PowerShell 7"
}
],
"powershell.powerShellDefaultVersion": "PowerShell 7",
"terminal.integrated.automationShell.windows": "C:\Program Files\PowerShell\7\pwsh.exe",
"terminal.external.windowsExec": "C:\Program Files\PowerShell\7\pwsh.exe",
"terminal.integrated.automationShell.osx": "",
"terminal.integrated.automationShell.linux": "",
"debug.javascript.autoAttachFilter": "smart",
"vs-kubernetes": {
"vscode-kubernetes.kubectl-path.windows": "C:\Users\genericuser\.vs-kubernetes\tools\kubectl\kubectl.exe",
"vscode-kubernetes.minikube-path.windows": "C:\Users\genericuser\.vs-kubernetes\tools\minikube\windows-amd64\minikube.exe",
"vscode-kubernetes.helm-path.windows": "C:\Users\genericuser\.vs-kubernetes\tools\helm\windows-amd64\helm.exe"
},
"mssql.connections": [
{
"server": "{{put-server-name-here}}",
"database": "{{put-database-name-here}}",
"user": "{{put-username-here}}",
"password": "{{put-password-here}}"
}
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell",
"path": "C:\Program Files\PowerShell\7\pwsh.exe"
},
"Command Prompt": {
"path": [
"${env:windir}\Sysnative\cmd.exe",
"${env:windir}\System32\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
},
"PowerShell 7": {
"path": "C:\Program Files\PowerShell\7\pwsh.exe",
"args": []
}
}
}
Attached Logs
EditorServices.log
StartEditorServices.log
vscode-powershell.log
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
The text was updated successfully, but these errors were encountered: