Problem when Form inherits from another Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using VS 2005/.Net 2.0. I have a base form that is contained in a
library project. When I try to inherit from this base form in another
project the designer get confused and displays the following error. Can I
not inhierit from a base form?
Thanks for your help!
Terry

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

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)
at
System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.GetType(String typeName)
at
System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
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)
 
Hi Terry,

I have performed a test based on your description but did not reproduce the
problem.

I create two projects--one is a class library project and the other is a
WinForm application project. In the class library project, I add a form.
Build the class library project and then add a reference to the class
library project in the WinForm project. I add a inherited form to the
WinForm project based on the form in the class library, and all works fine.

If you have code in the base form's constructor, or Load event handler,
these code will be executed when the inherited form is opened in the form
designer. I suggest that you comment out the code in the base form's
constructor and Load event handler to see if the problem would disappear.

If the problem is still not resolved, you may send me a sample project that
could just reproduce the problem. To get my actual email address, remove
'online' from my displayed email address.


Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Terry,

How about the problem now?

If the problem is still not solved, and you need our further assistance,
please feel free to let me know.

Thank you for using our MSDN Managed Newsgroup Support Service!

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Hi Linda,
Thank you for your response. It appears that I have things working. My
issue was caused by the following:
1) I did not provide a default constructor in my base class. Please confirm
that this is required.
2) I was using the DevExpress XtraGrid which for VS2005 needs to have a
registry entry set.

Please confirm that I do in fact need a default constructor in my base class.

Again,
Thanks for your help!!!
Terry
 
Hi Terry,

Yes, you need a default constructor that takes no parameter in the base
class.

In fact, in this case, we could not create a form derived from the base
form in the same project where the base form resides.

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Hi,


I am trying to open window form in designer (this form inherits another
window form

"BaseForm") ,
am getting exception and Visual studis is asking to debug or cancel message
alert.


I debugged and its said "Could not load file or assembly 'Wrappers.CLI,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies.
The system cannot find the file specified. "

The WSOD contains:


One or more errors encountered while loading the designer. The errors are
listed below. Some

errors can be fixed by rebuilding your project, while others may require
code changes.

"Could not load file or assembly 'Wrappers.CLI, Version=0.0.0.0,
Culture=neutral,

PublicKeyToken=null' or one of its dependencies. The system cannot find the
file specified"
Hide

at MyProject.BaseForm..ctor()

this is in C# project it has refernce to 'Wrappers.CLI' dll.

I tried

1. rebuilding

2. steps in http://www.codeproject.com/KB/cs/wsod.aspx

but none was working..

Thanks,
Ramki
 
Back
Top