Re: Why does the default Deserializer crash on array index expressions?
- From: "Eric Pierce" <epierce@xxxxxxxxxxxxxxxx>
- Date: Thu, 5 Jan 2006 16:03:27 -0500
Also, I suppose I should mention that in both examples where I use foo.bar
and foo[1].bar, bar is a public field of an object class of my creation and
not a property or a base type (int, double, etc.).
Thanks again in advance for any help!
- Eric
"Eric Pierce" <epierce@xxxxxxxxxxxxxxxx> wrote in message
news:%23RiWXkjEGHA.740@xxxxxxxxxxxxxxxxxxxxxxx
>
> Greetings,
>
> I have some windows forms controls that add their own code to the
> InitializeComponents() method of the control or form that uses them.
> Until now, this has gone pretty well as there are numerous examples out
> there for doing this. My code inserts a method call at the end of the
> serialization of the control that looks like this:
>
> this.myNumericUpDown6.MyMethod(this.foo.bar);
>
> This works fine. I'm doing my own code gen using a subclass of
> CodeDomSerializer that I assign to my custom controls. The problem I'm
> having arises when I generate expressions like this:
>
> this.myNumericUpDown6.MyMethod(this.foo[1].bar);
>
> The serialization works fine (or it wouldn't have generated the code) and
> when I build it and run it works great. There's no problem with foo[1]
> not being instantiated prior to the invocation of the MyMethod in
> InializeComponents(). The problem occurrs when I go back design mode on
> the form once this code is in place. The designer tries to deserialize it
> and blows up. Instead of my form in the design view, I get an error
> message with the red circle and white X that says "The designer cannot
> process the code at line ..."
>
> What do I have to do to make this kind of expression acceptable to the
> designer? Right now I'm just using the default deserializer like all the
> other examples. Do I have to do any custom code in the deserializer
> method to handle indexers?
>
> foo is an instance of a class that has an indexer. It's not a
> System.Array.
>
> Thanks in advance for your help
>
> - Eric
>
>
.
- Follow-Ups:
- References:
- Why does the default Deserializer crash on array index expressions?
- From: Eric Pierce
- Why does the default Deserializer crash on array index expressions?
- Prev by Date: Why does the default Deserializer crash on array index expressions?
- Next by Date: System.Windows.Forms.Design.Behavior.DropSourceBehavior
- Previous by thread: Why does the default Deserializer crash on array index expressions?
- Next by thread: Re: Why does the default Deserializer crash on array index expressions?
- Index(es):
Relevant Pages
|