[Mono-devel-list] Bug? get accessor self-refers

Gonzalo Paniagua Javier gonzalo at ximian.com
Sun May 4 16:04:41 EDT 2003


El dom, 04 de 05 de 2003 a las 19:55, Burton M. Strauss III escribió:
> mono 0.23 - Linux (RedHat 8)
> 
> // bug 00002 - seg fault
> 
> using System;
> 
>     public struct x {
>         protected byte p;
> 
>         public x(byte i) {
>                 p=i;
>         }
> 
>         public byte P {
>                 get {
>                         return P;
>                 }
>         }
>     }
> 
> class Sample {
>     public static void Main() {
>         x v = new x(3);
>         Console.WriteLine("\tP {0}", v.P );
>     }
> }
> 
> Seg faults when run.  If you change the 'return P' to 'return p', which is
> (of course) the correct program, it runs fine.  Shouldn't there be a better
> trap than an OS segmentation fault?

Well, may be you prefer the fancy "Application has generated an
exception that could not be handled" window that MS runtime generates
for such a program ;-).

-Gonzalo





More information about the Mono-devel-list mailing list