2010-04-07 Rodrigo Kumpera <rkumpera@novell.com>
[mono-project.git] / mono / tests / call_missing_class.il
blobc858f97c40ba8f09bfbac5bbd6ed0d848a082164
2 //  CIL which breaks the ECMA-335 rules. 
3 // this CIL should fail verification by a conforming CLI verifier.
5 .assembly 'call_missing_class_generated'
7   .hash algorithm 0x00008004
8   .ver  0:0:0:0
11 .class public auto ansi beforefieldinit MissingMember extends [mscorlib]System.Object
13         .method public hidebysig  specialname  rtspecialname instance default void .ctor ()  cil managed 
14         {
15                 .maxstack 8
16                 ldarg.0 
17                 call instance void object::.ctor()
18                 ret 
19         }
21         .method static private hidebysig void PrivateMethod ()  cil managed 
22         {
23                 .maxstack 8
24                 ret 
25         }
28         .field private int32 privateField
31 .class public auto ansi beforefieldinit Driver extends [mscorlib]System.Object
33         .method public hidebysig  specialname  rtspecialname instance default void .ctor ()  cil managed 
34         {
35                 .maxstack 8
36                 ldarg.0 
37                 call instance void object::.ctor()
38                 ret 
39         }
41         .method public static void NoInline() cil managed
42         {
43                 .maxstack 8
44                 ret
45         }
47         .method public static void TestMethod() cil managed
48         {
49                 .maxstack 8
50                 call void Driver::NoInline()
51                 call int32 [mscorlib]MissingClass::Method()
53                 leave END
54 END:
55                 ret
56         }
58         .method public static int32 Main() cil managed
59         {
60                 .entrypoint
61                 .maxstack 8
62                 .locals init ( class [mscorlib]System.Exception V_0, int32 V_1)
64                 ldc.i4.0
65                 stloc.1
67                 .try {
68                         call void Driver::TestMethod()
69                         ldstr ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>call_missing_class did not throw an exception"
70                         call void class [mscorlib]System.Console::WriteLine(string)
71                         ldc.i4.1 
72                         stloc.1
73                         leave END
74                 }
75                 catch [mscorlib]System.Exception {
76                         stloc.0
78                         ldloc.0
79                         callvirt instance class [mscorlib]System.Type class [mscorlib]System.Exception::GetType()
80                         ldtoken [mscorlib]System.TypeLoadException
81                         call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
82                         beq ARE_EQUAL
83                         ldstr ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>call_missing_class thrown {0} instead of System.TypeLoadException"
84                         ldloc.0 
85                         callvirt instance class [mscorlib]System.Type class [mscorlib]System.Exception::GetType()
86                         call void class [mscorlib]System.Console::WriteLine(string, object)
87                         ldc.i4.1 
88                         stloc.1
89 ARE_EQUAL:
90                         leave END
91                 }
94 END:
95                 ldloc.1
96                 ret
97         }