[Mono-bugs] [Bug 499009] New: Member Initialization introduces error

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Apr 28 17:36:18 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=499009


           Summary: Member Initialization introduces error
    Classification: Mono
           Product: Mono: Compilers
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: miguel at novell.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


The problem that we have is that we should only assign the result of the new
operation until we have finished initializing.   This problem was first
discovered by ASP.NET MVC:

using System;

class Foo {
    public int P { get; set; }

}

class Y {
    static void Main ()
    {
        Foo foo = new Foo ();
        foo.P = 1;

        Do (foo);
        Console.WriteLine ("OK");
    }

    static void Do (Foo f)
    {
        f = new Foo () {
            P = f.P
        };
        if (f.P != 1)
            throw new Exception ("Error, this should have been 1");
    }
}

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list