-
Notifications
You must be signed in to change notification settings - Fork 511
Extension crashes when targeting PowerShell 5.1 (PowerShellEditorServices DryIoc error) #4175
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
Extension crashes when targeting PowerShell 5.1 (PowerShellEditorServices DryIoc error) #4175
Comments
Hm...could you list out more environment details? I'm specifically curious what PowerShell modules might be installed, or other code running during startup, such as in your profile(s). |
Sure, here is a list of my installed modules and my PowerShell profile. |
Ah, interesting, I notice you're importing the chocolatey profile too. Can you comment out everything in your profile and see if this repros? |
It looks like it still happens if everything is commented out in the profile and also if I actually delete the profile file as well. |
Do you have any other profiles? What's the output of |
Output is below, the only file that exists is the last one (which I attached the contents of earlier),
|
Well, that at least rules out profiles. Maybe try bisecting the modules? That is, uninstall half at a time progressively to find if it stops reproducing. |
Ok...after a lot of (re-)investigation, we seem to have determined that this issue occurs when multiple versions of the
Note that's both 4.2.0.0, and 4.2.0.1. To be honest, both should work, but look at the actual error underneath (which ages ago I talked about with OmniSharp's developer, but didn't quite understand what was going on):
There is a type identity issue causing the This seems to be the same issue as seen in #3462 and #3827. We are figuring out how to fix it, but it's complicated 😳 Note that when this issues does not occur, we see |
Yay! @SeeminglyScience and I can successfully repro this (finally). First we downloaded System.Threading.Tasks.Extensions v4.5.4 (which is assembly version 4.2.0.1) and installed it to the GAC with Then we downloaded and installed System.Threading.Tasks.Extensions v4.5.2 (which is assembly version 4.2.0.0) and also installed it to the GAC. This reproduced the error! I believe if we can repro it, we're well on our way to (finally) fixing it. |
So what's happening is OmniSharp is referencing System.Threading.Tasks.Extensions 4.2.0.1, since that's what their manifests reference, but then when it actually loads System.Threading.Channels (which appears to have lied about its dependencies) 4.2.0.0 gets loaded instead, which then causes OmniSharp to bonk. So a potentially dangerous "workaround" would be to run
We think that OmniSharp needs to update its dependency on I'll try to build PSES against OmniSharp with an updated dependency, and if it works, get @david-driscoll to roll out a new version for us. We shall see. |
Just a small update, it does not require both versions of |
I was provided a preview |
@andschwa Seeing you in action like this brings hope that VSCode PowerShell Extention has a bright future. Thank you! |
Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead. |
Thanks so much @ALIENQuake ❤️ I was just so, so glad to get to the bottom of this one! |
Is this issue resolved, since I am still seeing similar behavior with WMF 5.1 across a few different machines? |
Thank you for your comment, but please note that this issue has been closed for over a week. For better visibility, consider opening a new issue with a link to this instead. |
Prerequisites
Summary
Hi,
Starting the VS Code extension with
causes the extension to crash, it works fine with PowerShell 7.2.6, but I need to use PowerShell 5.1 for certain legacy scripts.
This message appears in the terminal at startup. Similar to this issue here, but none of the resolutions for that thread worked. I have attempted to reinstall VS Code and the PowerShell extension but neither have worked. Additionally, I have another computer that has both VS Code and the extension installed and I cannot reproduce the error on it.
PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
CTRL
+SHIFT
+P
and then type>PowerShell: Show Session Menu
Visuals
No response
Logs
EditorServices.log
error.txt
ps_extension_output.txt
ps_editor_services_output.txt
The text was updated successfully, but these errors were encountered: