chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.34k stars 903 forks source link

Error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. #3228

Open TheBigBear opened 1 year ago

TheBigBear commented 1 year ago

Checklist

What You Are Seeing?

When I try to run choco or choco --version or choco list after I upgraded from chocolatey 1.40 to 2.0.0 chocolatey does not see to start up at all. All I get is a single line of output saying:

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

I will include the .NET framework install-info from that Windows server 2016 install.

choco.summary.log

chocolatey.log

asoftreport.txt

dotnetversions.txt

What is Expected?

I expect chocolatey to start up and give me the helpscreen or the version number or the list of installed packages. But instead I get a single line saying:

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

How Did You Get This To Happen?

I ran all of these cmds choco

choco --version

choco list

System Details

Installed Packages

can't show installed packages as it errors out

Output Log

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.


### Additional Context

_No response_
gep13 commented 1 year ago

@TheBigBear apologies on not getting back you to sooner about this!

Can I ask if you are still seeing this same problem?

This is a new one on me, as I don't think I have seen this problem before.

In the issue you created, you said the following:

Chocolatey Licensed Extension version: only gives above error

Just to confirm... Do you have the chocolatey.extension package installed at all? i.e. are you a paying customer of Chocolatey Software, for example with a Pro, or Business license?

I assume that everything was working correctly, prior to the upgrade to 2.0.0?

On your system, do you have any virus, or malware, software, that complete be interfering with the operation of Chocolatey?

On the file system, so you have anything in the C:\ProgramData\chocolatey\extensions folder? Is so, what do you have in there?

TheBigBear commented 1 year ago

@gep13 Hi Gary, no I am not a licensed user, sorry to have confused you. Yes, everything was working just fine up to the attempt to upgrade to version 2.0.0 This is one of a few server 2016 servers we have but the only one where it fails to run at all. The one and only AV on it is MS defender is enabled. And no, I have no extensions folder anymore, remember I had removed everything using the provided ps script. And if I remove C:\ProgramData\chocolatey\ and re-install now, the install looks ok, it finishes without errror, but on trying to start any choco cmd I get the dreaded errro above.

And I checked in my backups on the earlier version 1.4.0 I did have a extensions folder with 4 subfolders chocolatey-compatibility chocolatey-core chocolatey-dotnetfx chocolatey-windowsupdate

Bzly commented 1 year ago

I'm seeing this on a fresh install of chocolatey; I have just copied the PS install code from the install page.

As described above the install looks to complete successfully, I restart my shell and choco throws the error.

My chocolatey.log spits out the following per call of choco:

2023-07-31 18:34:51,854 13792 [DEBUG] - XmlConfiguration is now operational
2023-07-31 18:34:51,931 13792 [DEBUG] - Adding new type 'CygwinService' for type 'IAlternativeSourceRunner' from assembly 'choco'
2023-07-31 18:34:51,933 13792 [DEBUG] - Adding new type 'CygwinService' for type 'IInstallSourceRunner' from assembly 'choco'
2023-07-31 18:34:51,934 13792 [DEBUG] - Adding new type 'PythonService' for type 'IAlternativeSourceRunner' from assembly 'choco'
2023-07-31 18:34:51,934 13792 [DEBUG] - Adding new type 'PythonService' for type 'IListSourceRunner' from assembly 'choco'
2023-07-31 18:34:51,935 13792 [DEBUG] - Adding new type 'PythonService' for type 'IInstallSourceRunner' from assembly 'choco'
2023-07-31 18:34:51,935 13792 [DEBUG] - Adding new type 'PythonService' for type 'IUninstallSourceRunner' from assembly 'choco'
2023-07-31 18:34:51,937 13792 [DEBUG] - Adding new type 'RubyGemsService' for type 'IAlternativeSourceRunner' from assembly 'choco'
2023-07-31 18:34:51,937 13792 [DEBUG] - Adding new type 'RubyGemsService' for type 'IListSourceRunner' from assembly 'choco'
2023-07-31 18:34:51,938 13792 [DEBUG] - Adding new type 'RubyGemsService' for type 'IInstallSourceRunner' from assembly 'choco'
2023-07-31 18:34:51,939 13792 [DEBUG] - Adding new type 'SystemStateValidation' for type 'IValidation' from assembly 'choco'
2023-07-31 18:34:51,940 13792 [DEBUG] - Adding new type 'CacheFolderLockdownValidation' for type 'IValidation' from assembly 'choco'
2023-07-31 18:34:52,459 13792 [ERROR] - Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
2023-07-31 18:34:52,475 13792 [ERROR] - More Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at chocolatey.infrastructure.app.registration.ChocolateyRegistrationModule.RegisterDependencies(IContainerRegistrator registrator, ChocolateyConfiguration configuration)
   at chocolatey.infrastructure.app.registration.ContainerBinding.RegisterComponents(Container container)
   at chocolatey.infrastructure.registration.SimpleInjectorContainer.Initialize()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at chocolatey.console.Program.Main(String[] args)
2023-07-31 18:34:52,477 13792 [DEBUG] - Exiting with 1

It's not critical on this machine, so I will leave it in this state for troubleshooting attempts.

pauby commented 1 year ago

@Bzly So we can gather all the information we need, can you raise a new issue?

AmgadAlAdeemi commented 5 months ago

check your Nuget There are two or more references to same Nuget with different versions which have different methods, especially on high-project as PackageReference Include="linq2db" Version="3.7.0" on low level project and PackageReference Include="linq2db" Version="5.0.0" on high level project

gabienache commented 2 weeks ago

I've just ran into the same issue on a fresh installation, only to realize that there was no problem with the installation, but rather the system needed a restart. After restart choco runs with no problems.