[ubuntu-mono] [Bug 75460] Mono VM reports valid IL as invalid

Markus marjo691 at student.liu.se
Tue Dec 12 11:40:24 GMT 2006


Public bug reported:

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;

    }

}

** Affects: mono (Ubuntu)
     Importance: Undecided
         Status: Unconfirmed

-- 
Mono VM reports valid IL as invalid
https://launchpad.net/bugs/75460



More information about the Ubuntu-mono mailing list