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


           Summary: Invalid IL code
           Product: Mono: Runtime
           Version: 2.2.x
          Platform: Other
               URL: http://limada.sourceforge.net/
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: ---


Description of Problem:

got: System.InvalidProgramException: Invalid IL code

Maybe there is a problem with generic parameters in combination with nullable,
both of them as members of a static class. But I am not sure about this
"analysis"

Testcase:
    static class TestProgram {
        [STAThread]
        static void Main() {
            if (Problem<string, string>.BIsAClazz) {
                Console.Out.WriteLine("no problem 1");
            } else {
                Console.Out.WriteLine("no problem 2");
            }
        }
    }


    public class Problem<A, B> {
        protected static B NullB = default(B);       
        private static Nullable<bool>  _BIsA = null;
        public static bool BIsAClazz {
            get {
                _BIsA = typeof(A).IsAssignableFrom(typeof(B));
                return _BIsA.Value;
            }
        }

Actual Results:
Unhandled Exception: System.InvalidProgramException: Invalid IL code in
Tests.Problem`2:get_BIsAClazz (): IL_0028: call      0x0a00000b
  at Tests.TestProgram.Main () [0x00000]

Expected Results:
no problem 1

How often does this happen? 
always

Additional Information:
This does NOT make an error:

    public class Problem<A, B> {
        private static Nullable<bool>  _BIsA = null;
        public static bool BIsAClazz {
            get {
                _BIsA = typeof(A).IsAssignableFrom(typeof(B));
                return _BIsA.Value;
            }
        }
        protected static B NullB = default(B);    
    }

so maybe it depends on the order of execution 

cheers, 
lytico


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to