Desinger view error with simple inheritance: Constructor on type '' not found.

T

tribbles

I have a class that inherits user control:
public partial class ValidationSubDesigner : UserControl {

It works jsut fine, the problem occurs when I try to inherit it:
public partial class FieldCompareFieldDesigner : ParamDesigner {
//public partial class FieldCompareFieldDesigner : UserControl {


The top line is required in order to compile, the second line is
required in order to get the designer view to work. I get the error
below when I try to bring up the designer view.


The full eror and stack trace.


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.

Constructor on type
'AbacusControls.PropertyEditors.Designer.ValidationDesigner.SubDesigners.Test'
not found.
Hide

at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
at System.ComponentModel.Design.DesignSurface.CreateInstance(Type type)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateInstance(Type
type)
at
System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type
componentType, String name)
at
System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type
type, ICollection arguments, String name, Boolean addToContainer)
at
System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type
type, ICollection arguments, String name, Boolean addToContainer)
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)
 
S

Stoitcho Goutsev \(100\)

tribbles,

Do you by any chance declare constructors for your user control that have
parameters. VS designer requires that all controls have parameterless
constructor in order to create them. Keep in mind that the designer creates
instance of the base class, thus when you inherit from UserControl your new
control will be designable even if it doesn't have parameterless
constructor. All controls that inherit from your new control won't be
designable thought.


tribbles said:
I have a class that inherits user control:
public partial class ValidationSubDesigner : UserControl {

It works jsut fine, the problem occurs when I try to inherit it:
public partial class FieldCompareFieldDesigner : ParamDesigner {
//public partial class FieldCompareFieldDesigner : UserControl {


The top line is required in order to compile, the second line is
required in order to get the designer view to work. I get the error
below when I try to bring up the designer view.


The full eror and stack trace.


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.

Constructor on type
'AbacusControls.PropertyEditors.Designer.ValidationDesigner.SubDesigners.Test'
not found.
Hide

at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
at System.ComponentModel.Design.DesignSurface.CreateInstance(Type type)
at Microsoft.VisualStudio.Design.VSDesignSurface.CreateInstance(Type
type)
at
System.ComponentModel.Design.DesignerHost.System.ComponentModel.Design.IDesignerHost.CreateComponent(Type
componentType, String name)
at
System.ComponentModel.Design.Serialization.DesignerSerializationManager.CreateInstance(Type
type, ICollection arguments, String name, Boolean addToContainer)
at
System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.CreateInstance(Type
type, ICollection arguments, String name, Boolean addToContainer)
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)
 
T

tribbles

Yes the base class constructor does require 1 argument for its
constructor. It is an data object that hold all of the parameters that
need to be valdiated depending on the specific valdiation
impelementation.
 
T

tribbles

Added an empty constructor to the base and everything is working.
Thank you very much for the wonderful and quick repsonse! I learned
something new and had an easy fix. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top