Error in design mode when inheriting from a UserControl deriving class in .NET 2.0

  • Thread starter Thread starter nagar
  • Start date Start date
N

nagar

I'm upgrading my C# project from .NET 1.1 to .NET 2.0 and I've noticed
the following.

I have a base class called UserControl1 that inherits from
UserControl.

Then I created another class (BatchActionControl) that inherits from
my UserControlDerived and, although the applications runs correctly, I
get an error when trying to open FinalClass in the VS 2005 designer

Thanks.
Andrea

Here's the error I get.

Cannot show the design window for the file, because none of the
contained classes can be designed.
BatchActionControl --- cannot load the base class “UserControl1”.
Verify the existence of a reference to the assembly and that all the
projects have been generates

in
System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager
manager)
in
System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
manager)
in
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager
serializationManager)
in
Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32
fReload)
 
Hi Andrea,

Based on my understanding, you have a .NET 1.1 WinForms application project
which contains a UserControl called UserControl1. You upgrade this project
to a .NET 2.0 project and create another class that inherits from the
existing UserControl1 in the upgraded .NET 2.0 project. The problem is that
when you open the new UserControl derived from the UserControl1 in the
designer, you get a design time error. If I'm off base, please feel free to
let me know.

I performed a test based on your description, but didn't reproduce the
problem on my side. I can open the new UserControl in the designer without
any error.

In fact, when we open a UserControl in the designer, an instance of the
base class is created. If the base class is not available, the UserControl
won't be opened in the designer correctly.

You may have a try re-creating the UserControl1 in the upgraded .NET 2.0
project and copying the code in the previous UserControl1 to the new
UserControl to see if the problem still exists.

Hope this helps.

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 Linda,

actually all the forms and controls were created in .NET 1.1 and I
noticed that opening an inherited usercontrol didn't work.

I then created two user controls (in .NET 2.0) and tried to make one
inherit form the other. Once again, I'm getting the same design time
error.

The user controls are both in the same project (which is also the main
project that contains the EXE file).

Thanks.
Andrea
 
Hi Andrea,

Thank you for your response.
I then created two user controls (in .NET 2.0) and tried to make one
inherit form the other. Once again, I'm getting the same design time error.

I suggest that you build the project after you create a UserControl and
then create another UserControl that inherits from the previous
UserControl. In this case, you should not get any design time error when
you open the inherited UserControl in the designer.

Please try my suggestion and let me know the result.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Hi Andrea,

How about the problem now?

If 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
 
I've tried what you suggested.
I created a new control and built the project.

Then I created a new user control that inherits from the first one. I
got the same runtime exception.

I just noticed that this happened in the project I'm using (which I
converted from .NET 1.1). If I try to do the same thing on a new
project it seems to work fine.

I've also installed VS 2005 SP1 but nothing changed. Any other
suggestions? Maybe something got corrupted in the project file.
Thanks.
Andrea
 
Hi Linda,

I found the problem. It had to do with the delay signature of the
assembly. I removed that and now it works great.
Thanks so much for your help.
Andrea
 
Hi Andrea,

Thank you for your feedback on how you succeed in solving the problem.

I am not aware of this. I think it will benefit all of us!

If you have any other question in the future, please don't hesitate to
contact us. It's always our pleasure to be of assistance!

Have a nice weekend!

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Back
Top