choco icon indicating copy to clipboard operation
choco copied to clipboard

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

Open TheBigBear opened this issue 2 years ago • 7 comments

Checklist

  • [X] I have verified this is the correct repository for opening this issue.
  • [X] I have verified no other issues exist related to my problem.
  • [X] I have verified this is not an issue for a specific package.
  • [X] I have verified this issue is not security related.

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

  • Operating System: 10.0.14393.0
  • Windows PowerShell version: 5.1.14393.5582
  • Chocolatey CLI Version: only gives above error
  • Chocolatey Licensed Extension version: only gives above error
  • Chocolatey License type: no license purchased - free edition
  • Terminal/Emulator: windows powershell

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_

TheBigBear avatar Jun 25 '23 10:06 TheBigBear

@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?

gep13 avatar Jul 07 '23 15:07 gep13

@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

TheBigBear avatar Jul 07 '23 16:07 TheBigBear

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.

bzly avatar Jul 31 '23 17:07 bzly

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

pauby avatar Jul 31 '23 19:07 pauby

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

AmgadAlAdeemi avatar May 24 '24 18:05 AmgadAlAdeemi

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.

gabienache avatar Oct 17 '24 06:10 gabienache

Confirming that a reboot resolved this for me as well. Note: This took unusually long to install compared to prior sites I have installed for clients. I believe they have a poor internet connection and that could be a result of it or the system make be slow. Definitely suggest a reboot before re-installing. Thanks!

CalebBrendel avatar May 23 '25 13:05 CalebBrendel