I have recently been getting an error in the Windows Forms designer of VS2010SP1 when using inherited UserControls.
The error is
The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: DebugPanel --- The base class 'UI.Panels.PanelBase' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
PanelBase is a UserControl that is defined in the same class library as DebugPanel that also implements an interface IPanel (which is in turn defined in the same class library). IPanel implements an interface IBaseItem that is defined in a different class library.
So we have
DebugPanel (Library UI.Shared2)
- PanelBase (Library UI.Shared2)
- UserControl (System.Windows.Forms - .NET4)
- IPanel (Library UI.Shared2)
- IBaseItem (Library Net.Common)
PanelBase is designable correctly, the project all builds correctly and works but when I try and design any inherited control the designer fails. This is not limited to the DebugPanel control, but any control inheriting from PanelBase... I've also seen the issue with other controls that I use that have similar inheritance hierarchies.
I can generally resolve the problem temporarily by cleaning the library UI.Shared2, closing VS and then opening it again, rebuilding the solution and opening the designer. This will then work for a short while and then start to fail again.
Does anyone have any suggestions that can resolve this issue permanently without resorting to restarting VS?
Edit: I am targeting the full version of .NET 4 with all libraries.