Vscode-powershell: Powershell session not finishing - v2021.5.1

Created on 3 Jun 2021  路  20Comments  路  Source: PowerShell/vscode-powershell

Hey team,
Since the latest update, i'm not able to use the editor to run any code. Love that I wont get prompted to save now when running, not loving the fact the PowerShell session never completes now when running my auto loading profile (365 module signs in, which appear to be successful - Other than the latest ExchangeManagement module never popping out the creds prompt but I can work around using the lower version for now!)
All my modules pop up and sign ins are successful, but I cant figure out why the session hasn't finished to allow me to use the editor to run code now?
I've downgraded for now back to v2021.2.2 which lets me auto load my profile and sign in and let me carry on using the editor without issue.
VSCodeSessionError

Issue-Bug Needs-Repro-Info Needs PowerShell 5.1

All 20 comments

Hi,

Could you please provide more logging and environment information by following these steps?

Thanks!

Hi,

Could you please provide more logging and environment information by following these steps?

Thanks!

Hiya!

Here you go, wasn't sure which so you have all 3!

I updated to v2021.5.1, restarted, entered creds from the prompts and tried to run something using F5 from the editor again and got the same issue.

Thanks!
VSCode-Logs-20210603..zip

All three is perfect, thanks!

Ah, I see in the logs that this is with PowerShell 5.1. Can you try PowerShell 7 and see if it still repros?

I can, but, it's not managed Enterprise wide so this wont help for everyone here that uses Code as well as 5.1 on our prod servers. Also, embarrassingly im not sure how to update Code to use Ps7....
Is 5.1 no longer supported?

Ignore this comment, it is still an issue with the latest VSCode, I just hadnt moved editors away from the settings page so didnt see the "Starting Powershell" notification not going away after everything has completed!

Side note.... Now that im not prompted to save changes when using Editor, it doesnt run the code with the changes I made, unless I save it first. Is that intentional? I assumed it would allow me to run whatever was in that editor at that time, regardless of if id saved it or not?

It should _only_ not be prompting for untitled files, and that should only be the case in VS Code Insiders right now. Otherwise that behavior is unchanged. What happened was that we added this default config for their upcoming feature: https://github.com/PowerShell/vscode-powershell/pull/3357/files

For PowerShell files, it is to set to prompt for nonUntitledEditorsInActiveGroup or, "all editors except those that are untitled."

Sorry, haven't had a chance to look at the main part of this issue yet.

No worries, I'm in the UK so the weekend has already started

Happy Monday! Rearing to go to help out where I can for this!

Hey! Sorry, I was on vacation this last week and am just now back today. I should get to this on Monday, currently just triaging everything.

@baldieavenger I'm wondering if this has to do with the main PowerShell 5.1 bug https://github.com/PowerShell/vscode-powershell/issues/3395#issuecomment-859969488 that cropped up this release. Can you test this extension build? PowerShell-insiders.vsix.zip

Hi Andrew,
I tried this but it didnt help. I thought it might just be me and my local, but my colleague now sees the same issue after updating to Powershell too so not just me!

Hi Andrew,
Anything more you need from me to dig into this?
Thanks!
John

Something to add! I use a little Microsoft.VSCode_profile.ps1 which contains a pop out then invoke command so I can choose the ps1 profile I want to use at the time and its this causing the issue!
If I just use my log in script as Microsoft.VSCode_profile.ps1 it auto loads, prompts, signs in and then has finished doing its thing!
If I use my function to open and let me choose which one, it doesnt!
Microsoft.VSCode_profile.txt

Oh, that is helpful. I see your function uses System.Windows.Forms which I know is causing other issues too: https://github.com/PowerShell/vscode-powershell/issues/3410#issuecomment-860976636

Ah, well, at least we know the problem. My understanding is that it may be difficult to fix due to the way System.Windows.Forms interoperates with a program's threading. But maybe https://github.com/PowerShell/PowerShellEditorServices/issues/1295 will fix it? We shall see...

Thanks! Whilst I'm here...... Any ideas on another way I can open a dialogue box to ask me for a ps1 to load? Lol

Was this page helpful?
0 / 5 - 0 ratings