1 // This is a test that attempts to use BOX on an IsByRefLike struct.
3 .assembly extern mscorlib
6 .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
8 .assembly 'invalid-isbyreflike'
10 .custom instance void class [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::'.ctor'(int32) = (01 00 08 00 00 00 00 00 ) // ........
12 .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
13 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
14 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
16 .custom instance void class [mscorlib]System.Diagnostics.DebuggableAttribute::'.ctor'(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = (01 00 07 01 00 00 00 00 ) // ........
18 .hash algorithm 0x00008004
21 .module 'invalid-isbyreflike.exe'
24 .class public sequential ansi sealed beforefieldinit X
25 extends [mscorlib]System.ValueType
31 .class public sequential ansi sealed beforefieldinit R
32 extends [mscorlib]System.ValueType
34 .custom instance void class [mscorlib]System.Runtime.CompilerServices.IsByRefLikeAttribute::'.ctor'() = (01 00 00 00 ) // ....
36 .custom instance void class [mscorlib]System.ObsoleteAttribute::'.ctor'(string, bool) = (
37 01 00 52 54 79 70 65 73 20 77 69 74 68 20 65 6D // ..RTypes with em
38 62 65 64 64 65 64 20 72 65 66 65 72 65 6E 63 65 // bedded reference
39 73 20 61 72 65 20 6E 6F 74 20 73 75 70 70 6F 72 // s are not suppor
40 74 65 64 20 69 6E 20 74 68 69 73 20 76 65 72 73 // ted in this vers
41 69 6F 6E 20 6F 66 20 79 6F 75 72 20 63 6F 6D 70 // ion of your comp
42 69 6C 65 72 2E 01 00 00 ) // iler....
48 .class public auto ansi beforefieldinit G`1<T>
49 extends [mscorlib]System.Object
51 .method public hidebysig specialname rtspecialname
52 instance void .ctor() cil managed
57 IL_0001: call instance void [mscorlib]System.Object::.ctor()
60 } // end of method G`1::.ctor
63 .class public auto ansi beforefieldinit C
64 extends [mscorlib]System.Object
67 .method public hidebysig static int32 Main() cil managed
70 // Code size 171 (0xab)
72 .locals init (bool V_0,
83 IL_0004: call void C::BadMethod1()
86 IL_000b: leave.s IL_001f
89 catch [mscorlib]System.BadImageFormatException
93 IL_000f: ldstr "good - BadImageFormatException for BadMethod1"
94 IL_0014: call void [mscorlib]System.Console::WriteLine(string)
99 IL_001d: leave.s IL_001f
107 IL_0025: brfalse.s IL_0037
110 IL_0028: ldstr "bad - no exception when JITing BadMethod1"
111 IL_002d: call void [mscorlib]System.Console::WriteLine(string)
115 IL_0035: br.s IL_00a9
122 IL_003a: call void C::BadMethod2()
125 IL_0041: leave.s IL_0055
128 catch [mscorlib]System.TypeLoadException
132 IL_0045: ldstr "good - TypeLoadException for BadMethod2"
133 IL_004a: call void [mscorlib]System.Console::WriteLine(string)
138 IL_0053: leave.s IL_0055
146 IL_005b: brfalse.s IL_006d
149 IL_005e: ldstr "bad - no exception when JITing BadMethod2"
150 IL_0063: call void [mscorlib]System.Console::WriteLine(string)
154 IL_006b: br.s IL_00a9
161 IL_0070: call void C::BadMethod3()
164 IL_0077: leave.s IL_008b
167 catch [mscorlib]System.BadImageFormatException
171 IL_007b: ldstr "good - BadImageFormatException for BadMethod3"
172 IL_0080: call void [mscorlib]System.Console::WriteLine(string)
177 IL_0089: leave.s IL_008b
185 IL_0093: brfalse.s IL_00a5
188 IL_0096: ldstr "bad - no exception when JITing BadMethod3"
189 IL_009b: call void [mscorlib]System.Console::WriteLine(string)
193 IL_00a3: br.s IL_00a9
197 IL_00a7: br.s IL_00a9
201 } // end of method C::Main
204 // noinling is important - we want the JIT to fail on this method, not on Main().
205 .method public static hidebysig
206 default void BadMethod1 () cil managed noinlining
208 // Method begins at RVA 0x209c
209 // Code size 48 (0x30)
221 IL_000b: ldc.i4.s 0x0a
222 IL_000d: stfld int32 X::i
228 IL_001e: ldc.i4.s 0x2a
229 IL_0020: stfld int32 R::i
233 IL_0029: box R // box of an IsByRefLike type is not allowed
236 } // end of method C::BadMethod1
238 .method public hidebysig static void BadMethod2() cil managed noinlining
242 .locals init (class G`1<valuetype R> V_0)
244 IL_0001: newobj instance void class G`1<valuetype R>::.ctor()
247 } // end of method C::BadMethod2
249 .method public hidebysig static void BadMethod3() cil managed noinlining
254 IL_0001: call void C::GM<valuetype R>()
257 } // end of method C::BadMethod3
259 .method public hidebysig static void GM<T>() cil managed
265 } // end of method C::GM
268 .method public hidebysig specialname rtspecialname
269 instance default void '.ctor' () cil managed
271 // Method begins at RVA 0x20d8
275 IL_0001: call instance void object::'.ctor'()
278 } // end of method C::.ctor