[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Complex Property with Subproperties Crashing VS2005 SP1

Mark Olbert

2/15/2007 3:39:00 PM

I'm in a bit of a pickle here: I've got some kind of problem involving persisting some complex properties on a custom control, but
because VS2005 SP1 keeps crashing when it encounters the problem I'm at a loss as to how to figure out what's wrong.

Here's a sketch of the custom control and properties:

[ToolboxData("<{0}:DynamicSelector runat=server></{0}:DynamicSelector>")]
[Designer(typeof(DynamicSelectorDesigner))]
[ParseChildren(false)]
[PersistChildren(false)]
[ControlBuilder(typeof(DynamicSelectorBuilder))]
public class DynamicSelector : CompositeDataBoundControl
{
private List<DynamicSelectorStep> steps = new List<DynamicSelectorStep>();

[Category("Data")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public List<DynamicSelectorStep> Steps
{
get { return steps; }
}
}

Here's the base class of the various objects I trying to persist:

public class DynamicSelectorStep
{
public event DynamicSelectorDataHandler DataBinding;
public event EventHandler Completed;

private string title;
private int selectedID = -1;
private DataBindType dataNeed = DataBindType.Unknown;

protected DynamicSelectorStep()
{
}

[NotifyParentProperty(true)]
public string Title
{
get { return title; }
set { title = value; }
}

[Browsable(false)]
public virtual string ErrorMessage
{
get { return String.Empty; }
}

[Browsable(false)]
public virtual bool IsValid
{
get { return true; }
}

[Browsable(false)]
public int Value
{
get { return selectedID; }
set { selectedID = value; }
}

[Browsable(false)]
public DataBindType DataNeed
{
get { return DataNeed; }
set { dataNeed = value; }
}

public virtual WizardStep CreateWizardStep()
{
return null;
}

public virtual void Initialize()
{
}

public virtual void DataBind( IEnumerable data )
{
}

protected virtual void OnDataBinding( DataBindType dataNeed, string arg )
{
// store what we need for the next step
this.dataNeed = dataNeed;

if( DataBinding != null ) DataBinding(this, new DynamicSelectorDataArgs(this, dataNeed, arg));
}

protected virtual void OnCompleted()
{
if( Completed != null ) Completed(this, EventArgs.Empty);
}

internal virtual string DesignTimeHtml
{
get { return String.Empty; }
}
}

The crash occurs after I open the property editor for Steps in the designer and then close it. It crashes whether or not I've tried
to add a new step.

BTW, how do I inform the property editor for Steps that there are derived classes that can be added to the collection, as well, and
that the base class can't be added?

- Mark
4 Answers

Mark Olbert

2/15/2007 4:25:00 PM

0

A point of clarification: the crash occurs when I clikc on the Add button in the property editor that comes up when I try to add a
step to the step collection. Making DynamicSelectorStep publicly-constructable doesn't solve the problem.

- Mark

On Thu, 15 Feb 2007 07:39:14 -0800, Mark Olbert <ChairmanMAO@newsgroups.nospam> wrote:

>I'm in a bit of a pickle here: I've got some kind of problem involving persisting some complex properties on a custom control, but
>because VS2005 SP1 keeps crashing when it encounters the problem I'm at a loss as to how to figure out what's wrong.
>
>Here's a sketch of the custom control and properties:
>
>[ToolboxData("<{0}:DynamicSelector runat=server></{0}:DynamicSelector>")]
>[Designer(typeof(DynamicSelectorDesigner))]
>[ParseChildren(false)]
>[PersistChildren(false)]
>[ControlBuilder(typeof(DynamicSelectorBuilder))]
>public class DynamicSelector : CompositeDataBoundControl
>{
> private List<DynamicSelectorStep> steps = new List<DynamicSelectorStep>();
>
> [Category("Data")]
> [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
> [PersistenceMode(PersistenceMode.InnerProperty)]
> public List<DynamicSelectorStep> Steps
> {
> get { return steps; }
> }
>}
>
>Here's the base class of the various objects I trying to persist:
>
>public class DynamicSelectorStep
>{
> public event DynamicSelectorDataHandler DataBinding;
> public event EventHandler Completed;
>
> private string title;
> private int selectedID = -1;
> private DataBindType dataNeed = DataBindType.Unknown;
>
> protected DynamicSelectorStep()
> {
> }
>
> [NotifyParentProperty(true)]
> public string Title
> {
> get { return title; }
> set { title = value; }
> }
>
> [Browsable(false)]
> public virtual string ErrorMessage
> {
> get { return String.Empty; }
> }
>
> [Browsable(false)]
> public virtual bool IsValid
> {
> get { return true; }
> }
>
> [Browsable(false)]
> public int Value
> {
> get { return selectedID; }
> set { selectedID = value; }
> }
>
> [Browsable(false)]
> public DataBindType DataNeed
> {
> get { return DataNeed; }
> set { dataNeed = value; }
> }
>
> public virtual WizardStep CreateWizardStep()
> {
> return null;
> }
>
> public virtual void Initialize()
> {
> }
>
> public virtual void DataBind( IEnumerable data )
> {
> }
>
> protected virtual void OnDataBinding( DataBindType dataNeed, string arg )
> {
> // store what we need for the next step
> this.dataNeed = dataNeed;
>
> if( DataBinding != null ) DataBinding(this, new DynamicSelectorDataArgs(this, dataNeed, arg));
> }
>
> protected virtual void OnCompleted()
> {
> if( Completed != null ) Completed(this, EventArgs.Empty);
> }
>
> internal virtual string DesignTimeHtml
> {
> get { return String.Empty; }
> }
>}
>
>The crash occurs after I open the property editor for Steps in the designer and then close it. It crashes whether or not I've tried
>to add a new step.
>
>BTW, how do I inform the property editor for Steps that there are derived classes that can be added to the collection, as well, and
>that the base class can't be added?
>
>- Mark

Teemu Keiski

2/15/2007 5:35:00 PM

0

What is the exception you get? What does it tell? Stack overflow or
something?

--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice....
http://teemu...



"Mark Olbert" <ChairmanMAO@newsgroups.nospam> wrote in message
news:4829t2t70aqnv9gpejhjuu6c0md2rav6ph@4ax.com...
>A point of clarification: the crash occurs when I clikc on the Add button
>in the property editor that comes up when I try to add a
> step to the step collection. Making DynamicSelectorStep
> publicly-constructable doesn't solve the problem.
>
> - Mark
>
> On Thu, 15 Feb 2007 07:39:14 -0800, Mark Olbert
> <ChairmanMAO@newsgroups.nospam> wrote:
>
>>I'm in a bit of a pickle here: I've got some kind of problem involving
>>persisting some complex properties on a custom control, but
>>because VS2005 SP1 keeps crashing when it encounters the problem I'm at a
>>loss as to how to figure out what's wrong.
>>
>>Here's a sketch of the custom control and properties:
>>
>>[ToolboxData("<{0}:DynamicSelector runat=server></{0}:DynamicSelector>")]
>>[Designer(typeof(DynamicSelectorDesigner))]
>>[ParseChildren(false)]
>>[PersistChildren(false)]
>>[ControlBuilder(typeof(DynamicSelectorBuilder))]
>>public class DynamicSelector : CompositeDataBoundControl
>>{
>> private List<DynamicSelectorStep> steps = new
>> List<DynamicSelectorStep>();
>>
>> [Category("Data")]
>> [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
>> [PersistenceMode(PersistenceMode.InnerProperty)]
>> public List<DynamicSelectorStep> Steps
>> {
>> get { return steps; }
>> }
>>}
>>
>>Here's the base class of the various objects I trying to persist:
>>
>>public class DynamicSelectorStep
>>{
>> public event DynamicSelectorDataHandler DataBinding;
>> public event EventHandler Completed;
>>
>> private string title;
>> private int selectedID = -1;
>> private DataBindType dataNeed = DataBindType.Unknown;
>>
>> protected DynamicSelectorStep()
>> {
>> }
>>
>> [NotifyParentProperty(true)]
>> public string Title
>> {
>> get { return title; }
>> set { title = value; }
>> }
>>
>> [Browsable(false)]
>> public virtual string ErrorMessage
>> {
>> get { return String.Empty; }
>> }
>>
>> [Browsable(false)]
>> public virtual bool IsValid
>> {
>> get { return true; }
>> }
>>
>> [Browsable(false)]
>> public int Value
>> {
>> get { return selectedID; }
>> set { selectedID = value; }
>> }
>>
>> [Browsable(false)]
>> public DataBindType DataNeed
>> {
>> get { return DataNeed; }
>> set { dataNeed = value; }
>> }
>>
>> public virtual WizardStep CreateWizardStep()
>> {
>> return null;
>> }
>>
>> public virtual void Initialize()
>> {
>> }
>>
>> public virtual void DataBind( IEnumerable data )
>> {
>> }
>>
>> protected virtual void OnDataBinding( DataBindType dataNeed, string arg )
>> {
>> // store what we need for the next step
>> this.dataNeed = dataNeed;
>>
>> if( DataBinding != null ) DataBinding(this, new
>> DynamicSelectorDataArgs(this, dataNeed, arg));
>> }
>>
>> protected virtual void OnCompleted()
>> {
>> if( Completed != null ) Completed(this, EventArgs.Empty);
>> }
>>
>> internal virtual string DesignTimeHtml
>> {
>> get { return String.Empty; }
>> }
>>}
>>
>>The crash occurs after I open the property editor for Steps in the
>>designer and then close it. It crashes whether or not I've tried
>>to add a new step.
>>
>>BTW, how do I inform the property editor for Steps that there are derived
>>classes that can be added to the collection, as well, and
>>that the base class can't be added?
>>
>>- Mark

wawang

2/16/2007 1:54:00 AM

0

Hi Mark,

Would you please send me the reproducible project for further
investigation? If it proves reproducible, I will report it to product team.
Thanks.

You could also submit it to
http://connect.microsoft.com/Main/content/content.aspx?Cont... which
is monitored by our product team directly. Thank you for your effort.

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

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

Mark Olbert

2/16/2007 3:17:00 PM

0

Walter,

I'm sorry, but I was able to solve the problem...and don't recall which of the things I tried caused it. I think it had to do with
the settings for ParseChildren and PersistChildren.

- Mark