Skip to content
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

Licensed version has an incorrect dependency on PowerShell assemblies and will only load v3 and above #799

Closed
ferventcoder opened this issue Jun 14, 2016 · 3 comments

Comments

@ferventcoder
Copy link
Member

ferventcoder commented Jun 14, 2016

tl;dr, if you have a licensed version, you should upgrade to at least 1.4.1.

choco upgrade chocolatey.extension - this package is only available for licensed versions of choco

After further review, we determined it is actually an issue with how the licensed version was taking a dependency on System.Management.Automation that was incorrect, causing it to attempt to load only v3 and above. This means that if you were running PowerShell v2, the licensed assembly would not load correctly, causing other issues when trying to install packages.

This is easily seen if you run into it attempting to load the same version of System.Management.Automation several times.

Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.' 
Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.' 
Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.' 

Original

An issue was uncovered that attempting to upgrade PowerShell with Chocolatey creates a lock on the binaries that PowerShell is attempting to upgrade.

When attempting to install/upgrade PowerShell, there could be an issue that occurs that sets the system into a state where Chocolatey is not able to be used:

Could not load file or assembly 'System.Management.Automation, Version=3.0.0.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.' 

It cycles through all of the possibilities and can not find a suitable PowerShell to install.

We can attempt to do one of the following:

  • create a copy of those binaries and use those for the dependencies and then delete them after the run.
  • automatically fall back to system PowerShell when we see a particular update that is for PowerShell libraries.
  • something else

Of course my vote is for option 1.

@laurinkeithdavis
Copy link

So, I'm not sure what you mean by "attempting to upgrade PowerShell with Chocolatey". I'm not attempting to upgrade anything when this issue occurs. At most, I'm attempting to install a package, but not PowerShell. Do you mean a package that I am attempting to install is doing this (though, I'm pretty sure this last time, I was not actually installing anything)?

@ferventcoder
Copy link
Member Author

It's based on best guess of what could be going on. Does an upgraded WMF get pushed out as part of Windows Update/System Policy?

Looking at what we know so far:

  • Choco loads the PowerShell assemblies (which may lock the files) while choco.exe is running.
  • These are assemblies in the GAC.
  • Later when choco.exe runs, the assemblies are missing and it gives the errors above.

@ferventcoder ferventcoder removed this from the 0.9.10 milestone Jun 14, 2016
@ferventcoder ferventcoder removed their assignment Jun 14, 2016
@ferventcoder ferventcoder changed the title Upgrade of PowerShell with Chocolatey Host Causes Install Failure and Manual Remediation Licensed version has an incorrect dependency on PowerShell assemblies and will only load v3 and above Jun 14, 2016
@ferventcoder ferventcoder self-assigned this Jun 14, 2016
@ferventcoder ferventcoder added this to the 0.9.10 milestone Jun 14, 2016
@ferventcoder
Copy link
Member Author

Looks like I got a little ahead of myself. After further review, we determined it is actually an issue with how the licensed version was taking a dependency on System.Management.Automation that was incorrect, causing it to attempt to load only v3 and above. This means that if you were running PowerShell v2, the licensed assembly would not load correctly, causing other issues when trying to install packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants