[Mono-dev] Bug in compiler?

Alan McGovern alan.mcgovern at gmail.com
Mon Mar 12 04:07:03 EDT 2007


Just so you know the "this" that is being complained about is the second
one:

public Path(Node startingNode)
       : this(new InitialStep(***this***, startingNode))

You can't use the object because it hasn't had it's constructor finish
running.

Alan.

On 3/12/07, Steve Bjorg <steveb at mindtouch.com> wrote:
>
> The correct error message should be:
>         Keyword 'this' is not available in the current context
>
>
> Jerry,
>
> You cannot pass the reference to an unconstructed object.  Using
> 'this' in this fashion is illegal, because that Path instance has not
> yet been initialized.
>
>
> Cheers,
>
> - Steve
>
> ---------------------------------
> Steve G. Bjorg
>
> MindTouch
> 555 W. Beech St.
> Suite 501
> San Diego, CA 92101
>
> 619.795.8459 office
> 619.795.3948 fax
> 425.891.5913 mobile
>
>
>
> On Mar 11, 2007, at 7:00 PM, Jerry Haltom wrote:
>
> > public Path(Node startingNode)
> >       : this(new InitialStep(this, startingNode))
> > {
> >
> > }
> >
> >
> > I have that code as a ctor in a class. Nothing special that I can see
> > about it. Basically just calling another ctor to do some work.
> >
> > Keyword `this' is not valid in a static property, static method, or
> > static field initializer(CS0026)
> >
> > That is what I get when compiling it.
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> >
> >
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070312/e3c22422/attachment.html 


More information about the Mono-devel-list mailing list