Windows Develop Bookmark and Share   
 index > Windows Forms Designer > bug: "could not load type"
 

bug: "could not load type"

I moved the Type Abc.Def.Core.BaseControl from Assembly Abc.Def.Core.dll to Abc.Def.Interface.BaseControl in Assembly Abc.Def.Interface.dll.

Now inside the same solution there are other projects where I have some UserControls that derive from BaseControl. After the move the designer can't load any of them. I get the following errormessage:

Could not load type 'Abc.Def.Core.SomeObject' from assembly 'Abc.Def.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

at Abc.Def.Interface.BaseControl..ctor()

Now the buggy part is that it doesn't help to delete all bin and obj folders in the solution. After the rebuild is successfull. The designer still can't load the controls.

The solution is under VSS source control.

How can this happen? The designer obviously stores some internal information at some unexpected location that doesn't get updated when I move a type to a diffrenet assembly/namspace. The designer obviuosly still thinksthat it finds Abc.Def.Core.SomeObject in the same Assembly as BaseControl. Note that at runtime everything works just fine.

bitbonk  Saturday, July 28, 2007 1:02 PM

I experienced SAME problem. After doing R & D I found the solution.

This problem occurs because of wrong DLLs are being referenced.

CLEAN the projects, rebuild them and then the problem is solved.

Mandar C. Jambotkar  Wednesday, July 23, 2008 4:37 AM

Experiencing the same kind of problem. I added an INTERFACE to a set of controls in myusercontrols.dll that is actually in myinterfaces.dll. And I get the same error (cantload type "my interface").

I did a clean, and rebuild. No GO

I did a manual delete of all obj and bin directories and a rebuild. No GO.

I did a manual delete of all obj, bin, REBOOTED, and a rebuild...still No GO

VS-2008 SP1.

David V. Corbin  Thursday, October 09, 2008 1:22 AM

You can use google to search for other answers

Custom Search

More Threads

• SmartTag with custom UIType Editor
• ToolStrips inside ToolStripContainer location lost
• Creating a Bindable Control
• CreateTransaction or use a temporary object during object creation?
• Designer Loader failure when including IPersistComponentSettings interface within Component Class
• Manipulating data from two excel sheets into one using Visual Studio 2005
• Custom Control Collection Property
• 'HINT TEXT" in c# windows form for disabled controls
• Nullable type in property grid
• Default Enter and Cancel button C# Winforms?