Re: Why does the default Deserializer crash on array index expressions?

Tech-Archive recommends: Speed Up your PC by fixing your registry




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


.



Relevant Pages

  • Re: Why does the default Deserializer crash on array index expressions?
    ... i have also experienced some strange behaviour from the deserializer. ... the reason) would be to use a method, not an indexer. ... >> CodeDomSerializer that I assign to my custom controls. ... The designer tries to deserialize it ...
    (microsoft.public.dotnet.framework.windowsforms.designtime)
  • Why does the default Deserializer crash on array index expressions?
    ... CodeDomSerializer that I assign to my custom controls. ... with the red circle and white X that says "The designer cannot process the ... Right now I'm just using the default deserializer like all the ... to handle indexers? ...
    (microsoft.public.dotnet.framework.windowsforms.designtime)
  • Re: Does C#.Net support Layout managers?
    ... make much sense to me to rely on the designer for some controls, ... designer cannot help you complete. ... I seem to use generic Lists. ... The code I'm specifically talking about is the layout code. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Deriving - .NET example
    ... A Form class has fairly large interface which can be used to manipulate the window. ... This includes methods/properties such as changing window position/size, setting its style, back color, caption etc. as well as adding child controls. ... When designing custom form via MS Visual Studio designer, the corresponding C# code is designed which uses the aforementioned class Form and its interface to achieve the look created in the designer. ... Within the UI subsystem some sort of factory object would field that request and do the actual instantiation and initialization. ...
    (comp.object)
  • Re: Visual Basic 2005 - designer.vb page problem
    ... In order to eliminate this problem, I decided to move all the declarations ... This way the designer doesn't perform ... only standard ASP.NET controls or can you repro the problem through a very ... changed some thing in .aspx page. ...
    (microsoft.public.dotnet.framework.aspnet)