Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / invalid-token.il
1 /*
2 This test an invalid methoddef token
3 */
4 .assembly extern mscorlib
5 {
6   .ver 2:0:0:0
7   .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
8 }
9 .assembly 'bla'
10 {
11   .hash algorithm 0x00008004
12   .ver  0:0:0:0
13 }
14 .module ld_type.exe
15
16 .class public auto ansi beforefieldinit Driver
17         extends [mscorlib]System.Object
18 {
19         .method public static void Misc() {
20                 ret
21         }
22
23         .method public static void InvalidMethodDef ()
24         {
25                .maxstack 2
26                 .locals init (int32 bla)
27                 nop
28                 call void Driver::Misc()
29                 /*Token is 0x00AAAA, which is well beyond the numbers of methods here.*/
30                 .emitbyte 0xFE
31                 .emitbyte 0x06
32                 .emitbyte 0xAA
33                 .emitbyte 0xAA
34                 .emitbyte 0x00
35                 .emitbyte 0x06
36                 pop
37                 ret
38
39         }
40
41         .method public static int32 Main ()
42         {
43                 .entrypoint
44                 .maxstack 8
45                 .locals init (int32 V0)
46                 .try {
47                         call void Driver::InvalidMethodDef()
48                         //mini.c inline_method doesn't clean loader errors, meaning that System.Console fails with BadImageException
49                         //ldstr "InvalidMethodDef() should throw BadImageException"
50                         //call void class [mscorlib]System.Console::WriteLine(string)
51                         ldc.i4.1
52                         stloc.0
53                         leave END
54                 } catch [mscorlib]System.BadImageFormatException { 
55                         pop 
56                         ldc.i4.0 
57                         stloc.0
58                         leave END
59                 }
60 END:
61                 ldloc.0
62                 ret
63         }
64 }
65
66