PowerShell Integrated Console does not start on VSCode 1.55.2 (Stable) with PowerShell Preview 2021.4.2

1619554566-4c04d7c7-874b-4077-a2e4-3b993520c4a11619554562893.zip
powershell_editor_services_trace_server.zip
| Name | Version |
| --- | --- |
| Operating System | Windows_NT x64 10.0.19042 |
| VSCode | 1.55.2|
| PowerShell Extension Version | 2021.4.2 |
|Name|Value|
|---|---|
|PSVersion|5.1.19041.906|
|PSEdition|Desktop|
|PSCompatibleVersions|1.0 2.0 3.0 4.0 5.0 5.1.19041.906|
|BuildVersion|10.0.19041.906|
|CLRVersion|4.0.30319.42000|
|WSManStackVersion|3.0|
|PSRemotingProtocolVersion|2.3|
|SerializationVersion|1.1.0.1|
Visual Studio Code Extensions(Click to Expand)
|Extension|Author|Version|
|---|---|---|
|asm-code-lens|maziac|1.8.0|
|bracket-pair-colorizer-2|CoenraadS|0.2.0|
|code-spell-checker|streetsidesoftware|1.10.2|
|dezog|maziac|2.2.4|
|errorlens|usernamehw|3.2.6|
|gitlens|eamodio|11.4.1|
|material-palenight-theme|whizkydee|2.0.1|
|nex-fileviewer|maziac|1.1.0|
|night-owl|sdras|2.0.0|
|path-intellisense|christian-kohler|2.3.0|
|powershell-preview|ms-vscode|2021.4.2|
|python|ms-python|2021.4.765268190|
|rainbow-csv|mechatroner|1.8.1|
|sna-fileviewer|maziac|1.2.1|
|Untabify|ilich8086|0.0.2|
|vscode-icons|vscode-icons-team|11.4.0|
|vscode-inline-values-powershell|TylerLeonhardt|0.0.5|
|vscode-markdownlint|DavidAnson|0.40.4|
|vscode-sort-json|richie5um2|1.20.0|
|vscode-sqlite|alexcvzz|0.12.0|
|vscode-test-explorer|hbenl|2.19.6|
|xml|DotJoshJohnson|2.5.1|
|z80-asm-meter|theNestruo|1.5.0|
|z80-instruction-set|maziac|1.0.4|
|z80-unit-tests|maziac|1.2.0|
Thanks @kborowinski we are having some trouble reproducing this issue, and are not seeing anything interesting in the logs (thanks for providing those!), are you also seeing this issue one PowerShell 7? It would also be great to know if you have hit this in the past with other versions...in all likelihood we may need to add more logging to debug this. Thanks!
@SydneyhSmith Good tip with the PowerShell 7. The PowerShell Integrated Console starts correctly on PS 7.2 (daily). I've also noticed that when the console hangs during startup on PS 5.1, switching PowerShell session to 7.2 and then back to
5.1 unfreezes the console.
Edit: I don't have this issue on Preview 2021.4.1.
That's helpful, this does seem to repro specifically with Windows PowerShell 5.1. Hm...will have to debug.
This bug makes preview extension 90% useles in PowerShell 5.1 😭 It does work from time to time
I'll make sure it doesn't find it's way into stable 😓
It does work from time to time
Oof, that makes this harder.
Oof, that makes this harder.
@andschwa I've tested the behavior on 4 different computers and it follows the 80/20 pattern, i.e. the PIC on PS 5.1 hangs on start 8 out of 10 times.
Any chance you have logs from those sessions? I just got my old Windows box back up and running (I've been working on a Mac mini), seems to repro, I just gotta find what's going wrong now 🕵️
Annoyingly this doesn't repro when I am debugging it 😢
Talk about ironic. This repros with:
"powershell.developer.editorServicesWaitForDebugger": false
and then it stops reproducing (and doesn't seem to wait for the debugger!) with:
"powershell.developer.editorServicesWaitForDebugger": true
@rjmholt any ideas?
Hm...it's not 100% though for me. It's like 50/50.
1620244955-ae2c3707-365c-4519-a4e5-f01827ffd1481620244936081.zip
As requested - full log.
Ok, @PrzemyslawKlys and @kborowinski I could use your help. While I can occasionally repro this, and even under the debugger a couple times, I have so far been unable to find the information I need to solve it. What appears to happen is that the server code (the .NET app hosting PowerShell) is stuck waiting for PowerShell to run a work item (the PSES module code), and it's just never running. I've built a VSIX where the .NET code was compiled in debug configuration, has additional logs, and will continue to print logs to the console even after the banner is printed (this is normally prevented by unsubscribing the logger). Since you both seem to able to reproduce this more consistently and with:
"powershell.developer.editorServicesLogLevel": "Diagnostic",
Please try the attached VSIX (in a zip because GitHub wouldn't let me otherwise upload it), with diagnostic logs, and capture the logs printed to the Integrated Console when it hangs. While all I've done is add logs, build it locally and in debug mode, I cannot seem to reproduce the bug with this build.
Thank you!
@andschwa The first batch of logs from one machine but two different VSCode Insiders versions:
1620283399-fe2846fc-cf9b-4099-b1ba-732dccc0edb41620283397504.zip
1620283399-fe2846fc-cf9b-4099-b1ba-732dccc0edb41620283397504_powershell_editor_services_trace_server.zip
1620283729-2ae2b962-074d-408d-acc3-a86bcd185db11620283727771.zip
1620283729-2ae2b962-074d-408d-acc3-a86bcd185db11620283727771_powershell_editor_services_trace_server.zip
Additional logs from other machine with VSCode Stable:
1620284685-eebfe89b-b2df-471a-91d2-390223f8bf6e1620284684240.zip
1620284685-eebfe89b-b2df-471a-91d2-390223f8bf6e1620284684240_powershell_editor_services_trace_server.zip
If you need mine, please let me know.
Additional logs from other machine with _VSCode Stable_:
1620284685-eebfe89b-b2df-471a-91d2-390223f8bf6e1620284684240.zip
1620284685-eebfe89b-b2df-471a-91d2-390223f8bf6e1620284684240_powershell_editor_services_trace_server.zip
You're certain the integrated console hung in this session? The logs indicate the server is up and running and responding to requests...
Tomorrow I can post the logs again from that particular machine.
It's ok! I managed to get it to hang (though without diagnostic logs, of course) and can see that the _server_ is up and responding to requests, it's _just_ the console that doesn't get to the point of printing the prompt. So, that's a start!
The better news is I've managed to get it to hang more consistently, with logging! It only does so when I build as a VSIX and install it, rather than run it under a launched (and debugged) VS Code instance.
Ok, hear me out, but can you reproduce this?
Get the Integrated Console to hang, then open your settings.json and toggle:
"powershell.developer.editorServicesLogLevel": "Normal",
Like, if it were set to Diagnostics, change it to Normal, or something. When I do that and save the file, the console finally reaches its prompt.
Yup, I can reproduce that fairly consistently. When the console is "hung" and then I trigger a real workspace/didChangeConfiguration (by changing the settings), it unhangs. What's more, if you've typed any input while it's "hung" all that gets queued and when it unhangs it executes. We're going to work backwards from that, especially given some other oddities in the log around notifications, and changes in OmniSharp v0.19 to them.
I'm on the below build of Insiders and I see no hung integrated terminal, it is just not running at all.
https://twitter.com/wsmelton/status/1392130847734652933
I have gone in and changed the logging for the preview extension to diagnostic, verbose and back to normal (each with a reload and opening a PS1 file). No longs are generated and the extension shows no indication that it started. It is not until I do the restart PS session that it will start up and I can access to the integrated terminal.
I'd note I see this behavior on both extensions (stable and preview).
Version: 1.57.0-insider (system setup)
Commit: 37a12c9b0846167b2f68e9e1f276149d2d8b9b27
Date: 2021-05-12T14:14:26.024Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.19042
@wsmelton what version of PowerShell? Sounds like a potentially different issue to me.
This happens whether I'm using PS 7.1.3 or Windows PowerShell 5.1. Was not sure if it would be separate or not.
Ok! We think we have a more clear understanding of what's going on, for anybody who's interested https://github.com/OmniSharp/csharp-language-server-protocol/issues/588
This is still actively being debugged (heck, it's what I've spent most of the last few weeks looking at).
@kborowinski, @PrzemyslawKlys, @rjmholt, and others, can ya'll test this attached VSIX and tell me if it repros? I _think_ I fixed it with https://github.com/OmniSharp/csharp-language-server-protocol/pull/589
Umm, GitHub is erroring when I upload the zip.
Attached? Can you attach it? 😊
Trying in a new comment.
...
Nope. I get "is not included in the list"
Try this: https://www.icloud.com/iclouddrive/0W-vrs0b16mkOv6huKfqbMBug#PowerShell-Insiders
So far it works. I'll let you know.
@andschwa Tested on my home PC, so far so good. Will test tomorrow morning at work on two more machines.
Try this: https://www.icloud.com/iclouddrive/0W-vrs0b16mkOv6huKfqbMBug#PowerShell-Insiders
Tested on my personal and on the company machine the whole day. It worked perfect.
@andschwa Have used the Preview 2021.5.0 whole day at work without any problems so the fix apparently works, thanks!
Yay! Will make sure this patch is merged into OmniSharp and that everything on our end is updated before I do the next release.
I'll try to get a new preview out ASAP!
Most helpful comment
Yup, I can reproduce that fairly consistently. When the console is "hung" and then I trigger a real
workspace/didChangeConfiguration(by changing the settings), it unhangs. What's more, if you've typed any input while it's "hung" all that gets queued and when it unhangs it executes. We're going to work backwards from that, especially given some other oddities in the log around notifications, and changes in OmniSharp v0.19 to them.