Thursday, July 29, 2010

Sitecore Error in Package Designer/Installation Wizard


I just got the following exception in the Package Designer on my fairly clean Sitecore 6.1 install.

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


Exception Details: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ReflectionTypeLoadException: Unable to load one or more of the requested types.
Retrieve the LoaderExceptions property for more information.]
System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) +0
System.Reflection.Assembly.GetTypes() +96
Sitecore.Shell.Applications.Installer.Commands.Commands.Init() +48
Sitecore.Shell.Applications.Installer.Commands.Commands..cctor() +6

[TypeInitializationException: The type initializer for
'Sitecore.Shell.Applications.Installer.Commands.Commands' threw an exception.]
Sitecore.Shell.Applications.Installer.Commands.Commands.Init() +36
Sitecore.Shell.Applications.Installer.Designer..ctor() +10

Based on the findings from our support portal, I found out that quite a few customers had the same issue and that is it also popping up in Installation Wizard.
So I decided to publish a quick post about it.

The stack trace indicates that the Installer app is trying to load some commands via reflection and obviously fails during this process.
By merging the bin directory of my Sitecore installation with the clean distributive, I found out that a few assemblies were somehow different, specifically Sitecore.Kernel.dll and Interop.Shell32.dll. So I copied them over from the clean distributive…and that resolved the issue!
It begs the question how it happened specifically, and my hunch is that somehow the DLLs got overwritten during the build process by Visual Studio, but let’s keep that as mystery.

Happy troubleshooting!

19 comments:

Kamsar said...

I've seen a similar issue before and it was caused by doing something like this:

- Make a Sitecore site.
- Make a class library project that references Sitecore.Kernel.dll
- Reference the library from the web site
- Upgrade Sitecore thus changing Sitecore.Kernel
- The reference will sometimes cause the newer kernel to be overwritten

Alex Shyba said...

I think you got it and it is exactly what happened to me - great scenario :-)

yourhighness said...

Hi Alex,

I'm having a similar issue after updating to Sitecore 6.2.0(rev.091012) How can I get the clean distributive for this update version? Is there some depository because the newer updates don't come in a zip file as before? Please help.

Thanks,

Alex Shyba said...

yourhighness - email me: AS at sitecore net and I will send you the link ;-)

mark stiles said...

Thanks for the writeup Alex. This almost ruined my day and likely my weekend. keep up the writing.

Francesco Gallarotti said...

I am upgrading a 6.2 to a 6.5, and after having completed the upgrade to 6.3 during the next step (upgrade to 6.4) I am getting this error trying to install the package to upgrade the installation wizard.
The Sitecore.Kernel DLL that I have on the server is the correct one (6.3.0.3392) and yet I am getting the same error that you mention in this post.
Could you be so nice to send me a link to a clean bin folder for 6.3? Nonetheless I am wondering what could have gone wrong since I have even executed the batch file that is stored in the website temp folder to make sure all DLLs were replaced correctly.
Please help :)

Alex Shyba said...

Hi Francesco,

Sorry about the trouble you are having.

Do you have access to SDN?

All the downloads for 6.3.x are there:
http://goo.gl/1KB1j

Once you are there, find the version you need and look for this link: "Download a ZIP archive of the Sitecore CMS site root".

Hope this helps.

-alex

Francesco Gallarotti said...

I did find the bin folder on the SDN and checked each and every DLL. They all match. What else could be wrong then? I get the exact same error you mentioned in the exact same condition. I still have the original 6.2 installation and that one still works, of course.

Alex Shyba said...

Here is what I am suggesting:
- clear all asp.net temp files under c:\win\.net....

- clear everything from /sitecore/shell/applications/debug and /sitecore/shell/controls/debug

- do a diff on the whole web root by binary comparison

- try plugging a web.config file from clean distributive

Reach out to support at support.sitecore.net if none of these help.

Francesco Gallarotti said...

Thanks for your help Alex, it's always appreciated and I apologize for bothering you with this issue. I know I should have contacted support but since you had posted about this particular issue I figured you could have some insight :)
By the way I ended up doing all you said and found out that version 2.1.1.108 of IT Hit WebDav DLL was the problem. I rolled it back to version 2.0.2.41 and the uploader started working again.
Thanks again!
Francesco

Brian Blackie said...

Thanks guys for all your comments. Francesco solved it for me as I was missing the ITHit.. dll.
Keep up the good work Alex. You're a life saver on occasion and I mean that...!

Amy Myo said...

Actually I got away by adding ITHit.WebDAV.Server.dll to project reference.

Kyle Heon said...

We just noticed that we are getting this in our development environments. I suspect it's been this way since I applied 6.5 Update-4 (from Update-3). What I can't figure out is that it works in production and I used Beyond Compare to diff the bin folders (dev/prod) and there are no binary differences in any of the assemblies. None of the suggestions listed are working, any other ideas?

Kris Verheire said...

We have the same problem on our environment. On DEV and locally there is no problem, yet once on the ACC environment we do get this issue.
Bin is compared with beyondCompare aswell but still no problem is shown. Windows temporary folder isn't showing an overflow of files either as I heard that might be a problem too. All out of ideas and I would appreciate any input ...

Vineeth Vijayan said...

Hey,

I tried to upgrade Sitecore.NET 6.4.1 to 6.5 , But while install package only 4000 files where uploaded instead of 6151.Can any one helpout.

thanks
Vineeth

Johny Woller Skovdal said...

Thank you! I too was missing the "ITHit.WebDav.Server.dll" and adding that fixed the problem for me.

Johny Woller Skovdal said...

Thank you! I too was missing the "ITHit.WebDav.Server.dll" and adding that fixed the problem for me.

Unknown said...

Our 6.3.0, and 6.3.1 both have the same error trying to bring up the package designer, and it was due to mis-matched "ITHit.WebDav.Server.dll" as well....Ming

Unknown said...

Our 6.3.0, and 6.3.1 both have the same error trying to bring up the package designer, and it was due to mis-matched "ITHit.WebDav.Server.dll" as well....Ming