[Mono-bugs] [Bug 396350] New: Error CS0131 is reported when compiling code that casts a property, while it compiles cleanly with Microsoft's csc.exe

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jun 2 07:50:22 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=396350


           Summary: Error CS0131 is reported when compiling code that casts
                    a property, while it compiles cleanly with Microsoft's
                    csc.exe
           Product: Mono: Compilers
           Version: 1.2.6
          Platform: All
        OS/Version: Ubuntu
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: jo.vermeulen at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Here is a basic test case:

using System;

public class Person
{
    private string _name;

    public string Name
    {
        get { return _name; }
        set { _name = value; }
    }

    public static void Main(string[] args)
    {
        Person johnDoe = new Person();
        (string)johnDoe.Name = "John Doe";
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    }
}

It fails on the line with the ^^^^ markers.

Output:

$ gmcs cs0131.cs
cs0131.cs(16,30): error CS0131: The left-hand side of an assignment must be a
variable, a property or an indexer
Compilation failed: 1 error(s), 0 warnings

Expected result:

Compilation should succeed, it does so with Microsoft's C# compiler.

-- Jo


-- 
Configure bugmail: https://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