Mono VM reports valid IL as invalid

Bug #75460 reported by Markus
2
Affects Status Importance Assigned to Milestone
mono
Fix Released
Unknown
mono (Ubuntu)
Fix Released
High
Unassigned

Bug Description

The code below runs fine on MS .net, but fails in mono in ubuntu. I've compiled with both MS C# compiler, csc.exe, and with mono's mcs, both compiles fine, but mono cannot run the applications.

Mono gives this error when running the mcs compiled code:

Unhandled Exception: System.InvalidProgramException: Invalid IL code in Tester:Main (string[]): IL_0058: stloc.s 5

And a almost identical when running the csc compiled one:

Unhandled Exception: System.InvalidProgramException: Invalid IL code in Tester:Main (string[]): IL_0057: stloc.3

..
As I said, when executed on MS Windows in MS .net the csc compiled code runs fine.

Here is the C# code that causes the errors:

/* This class works fine */
public class Works {

    private double val;

    public double this[int i, int j] {

        get { return val; }

        set { val = value; }

    }

    public Works(double val)
    { this.val = val; }

}

/* Same code as struct breaks */

public struct Breaks {

    private double val;

    public double this[int i, int j] {

        get { return val; }

        set { val = value; }

    }

    public Breaks(double val)
    { this.val = val; }

}

public class Tester {

    public static void Main(string[] args)

    {

        System.Console.WriteLine("This works");

        Works w = new Works(3.0);

        w[0, 0] += 3.0;

        System.Console.WriteLine("This breaks");

        Breaks b = new Breaks(3.0);

        b[0, 0] += 3.0;

    }

}

Revision history for this message
Sebastian Dröge (slomo) wrote :

Thanks for reporting this. I can reproduce this here with both mcs and gmcs and running with mono 1.2.2.1... I'll forward this upstream.

Changed in mono:
importance: Undecided → High
status: Unconfirmed → Confirmed
Changed in mono:
status: Unknown → Fix Released
Revision history for this message
Sebastian Dröge (slomo) wrote :

Fixed in feisty with 1.2.3

Changed in mono:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.