Thursday, December 29, 2005

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

Sometimes when working with a solution containing multiple projects, with several forms some of them containing user controls, Visual Studio .NET 2005 produces the following error when you try to open the form in the form designer:
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
In some cases the following approach helps solving this issue:
  1. Close the form designer
  2. Close the solution and Visual Studio
  3. From the project that contains the problematic form delete the bin and the obj folder
  4. Start Visual Studio again and load your solution
  5. Rebuild the solution
  6. Reload the form
Not nice, but at least it's a workaround. I don't know yet how to reproduce the issue, but it seems to be related to user controls in one project which are used in a form in a different project.


Anonymous said...

Hi Mate,

this absolutely didnt work for me :
and i also tried to change the AssemblyVersion to a fixed number instead of using the star character for autoincrementing, as said in some posts.

I'm working in a single assembly,
in which I declare 1 control that uses a third party control.

The error i've got is :

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

at System.Reflection.Module.GetTypesInternal(StackCrawlMark& stackMark)
at System.Reflection.Assembly.GetTypes()
at Microsoft.VisualStudio.Shell.Design.AssemblyObsoleteEventArgs..ctor(Assembly assembly)
at Microsoft.VisualStudio.Design.VSDynamicTypeService.ReloadAssemblyIfChanged(String codeBase)
at Microsoft.VisualStudio.Design.VSDynamicTypeService.CreateDynamicAssembly(String codeBase)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly()
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, String description)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchProjectEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.GetType(ITypeResolutionService trs, String name, Dictionary`2 names)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.FillStatementTable(IDesignerSerializationManager manager, IDictionary table, Dictionary`2 names, CodeStatementCollection statements, String className)
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

Manfred said...

Well, as I said, it sometimes works. You seem to have encountered a different scenario in which my solution doesn't work.

Anonymous said...

Thanks for your post. Your suggestion worked for me!

Black Fox said...

It also worked for me, thanks.

Anonymous said...

Excelelnt, worked a treat!

BigMoshi said...

I was figuring this out the whole of today. It occured after I added user controls in the main project. Deleting "obj" directory worked for me. TY.

sharpguru said...

I have this problem with vs 2005 using the Web Client Software Factory - Clean and Rebuild worked for me

Anonymous said...

This is a very helpfull to me thanks...

Anonymous said...

This also worked with a Silverlight application too. Thanks!

Anonymous said...

Worked for me!

Claudiu Constantin said...

That worked for me. :)

Anonymous said...

Thanks! After 5 years it solved my problem on Visual Studio 2008 too.

Anonymous said...

Try turning off "For fast searching, allow Indexing Service to index this folder" on the project or solution folder. Just select properties on the folder and click advance.

Anonymous said...

I had the same problem with WPF windows in design mode. I knew restarting VS 2008 and rebuilding the project usually solves the problem but in this case it didn't. I absolutely could not locate any bug.

Deleting bin and obj worked for me. Great! Thank you very much :).

Anonymous said...

I solved it my changing the configuration 'Any CPU' from 'Mixed Platform'

Anonymous said...

I do not know... what is the reason... but the solution worked for me.... THANKS A LOT

Anonymous said...

Thank you!
Seems it work for me!


Post a Comment

All comments, questions and other feedback is much appreciated. Thank you!