-
Notifications
You must be signed in to change notification settings - Fork 511
Profile fails to load when System.Windows.Forms
objects are used, hanging extension
#3394
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
Comments
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! |
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.... |
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 |
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 #3395 (comment) that cropped up this release. Can you test this extension build? PowerShell-insiders.vsix.zip |
Hi Andrew, |
Hi Andrew, |
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! |
Oh, that is helpful. I see your function uses |
Looks like the same cause then for both of these too! |
Ah, well, at least we know the problem. My understanding is that it may be difficult to fix due to the way |
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 |
@rjmholt thinks that we may have missed a location in PSES where we are not using |
This setting instructs the extension to wait for a debugger to be attached to the PowerShell process that it starts. That's why it's emitting the PID (which is different every time because new processes each have a new Process ID). It's used by developers for debugging the extension. Unless you want to attach a debugger to the extension's PowerShell process, leave it set to
Can you state what that behavior is? Got a lot of issues and discussions happening, trying to keep this all straight is hard. |
No problem! |
Instead of: $file = Get-FileName -initialDirectory "C:\Users\USER\PATH\Documents\WindowsPowerShell"
"&'$file'" | invoke-expression Can you try: $file = Get-FileName -initialDirectory "C:\Users\USER\PATH\Documents\WindowsPowerShell"
& $file |
No change :( |
You're certain you've uninstalled the PowerShell extension from the marketplace and manually installed the VSIX I posted? I can no longer reproduce your issue with the dev build I posted, while I could reproduce it from the marketplace version. What version are you seeing on startup in the integrated console? |
I tried changing |
Since the original bug in this issue is fixed, and that fix is now merged and will be in the next release, I will mark this issue as resolved. For your new problem, could you kindly open a new issue? You may want to wait until the extension is updated so you can try to reproduce it...take a look on Monday! |
This issue has been marked as fixed. It has been automatically closed for housekeeping purposes. |
I mean, its the same issue just worked through symptoms and the Beta isnt working for me as mentioned and after trying everything requested and providing all the logs but hey ho.... |
So, your issue goes away when you execute the code directly in your profile script, right? It now only fails when it's executed through |
@andschwa I installed the preview linked and initial tests have allowed me to debug as expected. I'll continue to run some tests today. If debugging fails again, should I open a new issue or is there one I can reference since this has been closed? |
If it fails again it's probably a new (if related) problem, so worth a new issue for fresh discussion |
It always worked when executing the code directly, I've only ever had the problem when using the |
It's out! Give it a go. This particular issue seems like something else is going on that Rob and I need to debug with you. That line of PowerShell itself is confusing, as it's first invoking the file |
Thought things were working well, but started having issues. Boiled it down to the simplest steps I could. |
I tried today and no joy :( I manage multiple O365 tenants and have multiple creds for different things and this was a really efficient way for me to control which Code Session loads into which O365 session. |
@andschwa This is fixed with the latest update today! |
Awesome! So glad to hear that @baldieavenger. |
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.
The text was updated successfully, but these errors were encountered: