-
Notifications
You must be signed in to change notification settings - Fork 511
Dependencies erroneously loaded from GAC first in Windows PowerShell #2103
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 @dammejed thanks for opening an issue, we often see start-up issues when system configuration like group policy, execution policy or antivirus are in place...your error message is a bit different from the one we typically see in this case but I am wondering if you are operating in a restricted system? |
@SydneyhSmith There are undoubtedly GPOs applied to my machine, but none I'm aware of that would restrict powershell execution. I already checked the guide for installations in restricted environments, The logs show that, at the very least, the entry point for that PS module is entered, which I would assume means that the execution policy isn't restricting things, correct?
|
On a hunch, I checked if I had the dependency mentioned in the exception (Serilog) in my GAC, and it turns out I did, version 2.0.0.0. I uninstalled Serilog from the GAC, and the extension now works as expected. I'm not sure why the GAC version was used, given that it's clearly not the minimum version needed, but it is what it is, I suppose. I can close this issue, since I'm no longer affected, or I can leave it open if that's (managing the correct dependency versions) something you want to tackle. Let me know! |
Ah nice hunch! It's a bug on our part then; we only add the types we immediately call into on startup and let them load their dependencies as they go. From this it sounds like that's fragile and we should eagerly load everything (although in PS 6+ this isn't a problem actually) |
Yeah since the .NET Framework loads from the GAC first, we'll probably need to load everything ourselves... Would be a great opportunity to try to take advantage of the RequiredAssemblies field in our module manifest |
I know this is the older issue, but #2538 has some more pertinent discussion so I'll deduplicate to that and pin that one. Loading from the GAC first is a by-design behaviour in .NET Framework that we can't work around and the issue is that Serilog's assembly versioning is deliberately broken. The solution for us is likely to remove Serilog. |
Issue Description
Powershell services appears to crash on launch with 'Missing method exception:'
Attached Logs
Powershell-logs.zip
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: