e86615c1c3055d8cbb50cf52d5ddd90e9b4bcd3d
[mono.git] / mcs / class / Mono.Debugger.Soft / Test / dtest-app.cs
1 /*
2  * dtest-app.cs:
3  *
4  *   Application program used by the debugger tests.
5  */
6 using System;
7 using System.Runtime.CompilerServices;
8 using System.Reflection;
9 using System.Reflection.Emit;
10 using System.Diagnostics;
11 using System.Threading;
12 using System.Collections.Generic;
13 using System.Linq;
14
15 public class TestsBase
16 {
17 #pragma warning disable 0414
18 #pragma warning disable 0169
19         public int base_field_i;
20         public string base_field_s;
21         static int base_static_i = 57;
22         static string base_static_s = "C";
23 #pragma warning restore 0414
24 #pragma warning restore 0169
25
26         public virtual string virtual_method () {
27                 return "V1";
28         }
29 }
30
31 public enum AnEnum {
32         A = 0,
33         B= 1
34 }
35
36 public sealed class Tests3 {
37         public static void M1 () {
38         }
39
40         static void M2 () {
41         }
42
43         public void M3 () {
44         }
45
46         void M4 () {
47         }
48
49 }
50
51 public static class Tests4 {
52         static Tests4 () {
53         }
54 }
55
56 public class AAttribute : Attribute {
57         public int afield;
58 }
59
60 public class BAttribute : AAttribute {
61         public int bfield;
62 }
63
64 [DebuggerDisplay ("Tests", Name="FOO", Target=typeof (int))]
65 [DebuggerTypeProxy (typeof (Tests))]
66 [BAttribute (afield = 1, bfield = 2)]
67 public class Tests2 {
68         [DebuggerBrowsableAttribute (DebuggerBrowsableState.Collapsed)]
69         public int field_j;
70         public static int static_field_j;
71
72         [DebuggerBrowsableAttribute (DebuggerBrowsableState.Collapsed)]
73         public int AProperty {
74                 get {
75                         return 0;
76                 }
77         }
78
79         public void invoke () {
80         }
81 }
82
83 public struct AStruct : ITest2 {
84         public int i;
85         public string s;
86         public byte k;
87         public IntPtr j;
88         public int l;
89 /*
90         public AStruct () {
91                 i = 0;
92                 s = null;
93                 k = 0;
94                 j = IntPtr.Zero;
95                 l = 0;
96         }
97 */
98         public AStruct (int arg) {
99                 i = arg;
100                 s = null;
101                 k = 0;
102                 j = IntPtr.Zero;
103                 l = 0;
104         }
105
106         [MethodImplAttribute (MethodImplOptions.NoInlining)]
107         public int foo (int val) {
108                 return val;
109         }
110
111         [MethodImplAttribute (MethodImplOptions.NoInlining)]
112         public static int static_foo (int val) {
113                 return val;
114         }
115
116         [MethodImplAttribute (MethodImplOptions.NoInlining)]
117         public int invoke_return_int () {
118                 return i;
119         }
120
121         [MethodImplAttribute (MethodImplOptions.NoInlining)]
122         public static int invoke_static () {
123                 return 5;
124         }
125
126         [MethodImplAttribute (MethodImplOptions.NoInlining)]
127         public IntPtr invoke_return_intptr () {
128                 return j;
129         }
130
131         [MethodImplAttribute (MethodImplOptions.NoInlining)]
132         public void invoke_mutate () {
133                 l = 5;
134         }
135
136         public int invoke_iface () {
137                 return i;
138         }
139
140         public override string ToString () {
141                 return i.ToString ();
142         }
143 }
144
145 public class GClass<T> {
146         public T field;
147         public static T static_field;
148
149         [MethodImplAttribute (MethodImplOptions.NoInlining)]
150         public GClass () {
151         }
152
153         [MethodImplAttribute (MethodImplOptions.NoInlining)]
154         public void bp<T2> () {
155         }
156 }
157
158 public struct GStruct<T> {
159         public T i;
160
161         public int j;
162
163         [MethodImplAttribute (MethodImplOptions.NoInlining)]
164         public int invoke_return_int () {
165                 return j;
166         }
167 }
168
169 public struct NestedStruct {
170         NestedInner nested1, nested2;
171 }
172
173 public struct NestedInner {
174 }
175
176 public interface IRecStruct {
177         void foo (object o);
178 }
179
180 struct RecStruct : IRecStruct {
181         public object o;
182
183         public void foo (object o) {
184                 this.o = o;
185         }
186 }
187
188 interface ITest
189 {
190         void Foo ();
191         void Bar ();
192 }
193
194 interface ITest<T>
195 {
196         void Foo ();
197         void Bar ();
198 }
199
200 class TestIfaces : ITest
201 {
202         void ITest.Foo () {
203         }
204
205         void ITest.Bar () {
206         }
207
208         TestIfaces<int> Baz () {
209                 return null;
210         }
211 }
212
213 class TestIfaces<T> : ITest<T>
214 {
215         void ITest<T>.Foo () {
216         }
217
218         void ITest<T>.Bar () {
219         }
220 }
221
222 public interface ITest2
223 {
224         int invoke_iface ();
225 }
226
227 public class Tests : TestsBase, ITest2
228 {
229 #pragma warning disable 0414
230         int field_i;
231         string field_s;
232         AnEnum field_enum;
233         bool field_bool1, field_bool2;
234         char field_char;
235         byte field_byte;
236         sbyte field_sbyte;
237         short field_short;
238         ushort field_ushort;
239         long field_long;
240         ulong field_ulong;
241         float field_float;
242         double field_double;
243         Thread field_class;
244         IntPtr field_intptr;
245         int? field_nullable;
246         static int static_i = 55;
247         static string static_s = "A";
248         public const int literal_i = 56;
249         public const string literal_s = "B";
250         public object child;
251         public AStruct field_struct;
252         public object field_boxed_struct;
253         public GStruct<int> generic_field_struct;
254         public KeyValuePair<int, object> boxed_struct_field;
255         [ThreadStatic]
256         public static int tls_i;
257         public static bool is_attached = Debugger.IsAttached;
258         public NestedStruct nested_struct;
259
260 #pragma warning restore 0414
261
262         public class NestedClass {
263         }
264
265         public int IntProperty {
266                 get {
267                         return field_i;
268                 }
269                 set {
270                         field_i = value;
271                 }
272         }
273
274         public int ReadOnlyProperty {
275                 get {
276                         return field_i;
277                 }
278         }
279
280         public int this [int index] {
281                 get {
282                         return field_i;
283                 }
284         }
285
286         public static void wait_one ()
287         {
288                 ManualResetEvent evt = new ManualResetEvent (false);
289                 evt.WaitOne ();
290         }
291
292         public static int Main (String[] args) {
293                 tls_i = 42;
294
295                 if (args.Length > 0 && args [0] == "suspend-test")
296                         /* This contains an infinite loop, so execute it conditionally */
297                         suspend ();
298                 if (args.Length >0 && args [0] == "unhandled-exception") {
299                         unhandled_exception ();
300                         return 0;
301                 }
302                 if (args.Length >0 && args [0] == "unhandled-exception-endinvoke") {
303                         unhandled_exception_endinvoke ();
304                         return 0;
305                 }
306                 if (args.Length >0 && args [0] == "unhandled-exception-user") {
307                         unhandled_exception_user ();
308                         return 0;
309                 }
310                 if (args.Length >0 && args [0] == "wait-one") {
311                         wait_one ();
312                         return 0;
313                 }
314                 breakpoints ();
315                 single_stepping ();
316                 arguments ();
317                 objects ();
318                 objrefs ();
319                 vtypes ();
320                 locals ();
321                 line_numbers ();
322                 type_info ();
323                 assembly_load ();
324                 invoke ();
325                 exceptions ();
326                 exception_filter ();
327                 threads ();
328                 dynamic_methods ();
329                 user ();
330                 type_load ();
331                 regress ();
332                 gc_suspend ();
333                 set_ip ();
334                 step_filters ();
335                 local_reflect ();
336                 if (args.Length > 0 && args [0] == "domain-test")
337                         /* This takes a lot of time, so execute it conditionally */
338                         domains ();
339                 if (args.Length > 0 && args [0] == "ref-emit-test")
340                         ref_emit ();
341                 if (args.Length > 0 && args [0] == "frames-in-native")
342                         frames_in_native ();
343                 if (args.Length > 0 && args [0] == "invoke-single-threaded")
344                         new Tests ().invoke_single_threaded ();
345                 if (args.Length > 0 && args [0] == "invoke-abort")
346                         new Tests ().invoke_abort ();
347                 new Tests ().evaluate_method ();
348                 return 3;
349         }
350
351         public static void local_reflect () {
352                 //Breakpoint line below, and reflect someField via ObjectMirror;
353                 LocalReflectClass.RunMe ();
354         }
355
356         public static void breakpoints () {
357                 /* Call these early so it is JITted by the time a breakpoint is placed on it */
358                 bp3 ();
359                 bp7<int> ();
360                 bp7<string> ();
361
362                 bp1 ();
363                 bp2 ();
364                 bp3 ();
365                 bp4 ();
366                 bp4 ();
367                 bp4 ();
368                 bp5 ();
369                 bp6<string> (new GClass <int> ());
370                 bp7<int> ();
371                 bp7<string> ();
372         }
373
374         [MethodImplAttribute (MethodImplOptions.NoInlining)]
375         public static void bp1 () {
376         }
377
378         [MethodImplAttribute (MethodImplOptions.NoInlining)]
379         public static void bp2 () {
380         }
381
382         [MethodImplAttribute (MethodImplOptions.NoInlining)]
383         public static void bp3 () {
384         }
385
386         [MethodImplAttribute (MethodImplOptions.NoInlining)]
387         public static void bp4 () {
388         }
389
390         [MethodImplAttribute (MethodImplOptions.NoInlining)]
391         public static void bp5 () {
392         }
393
394         [MethodImplAttribute (MethodImplOptions.NoInlining)]
395         public static void bp6<T> (GClass<int> gc) {
396                 gc.bp<int> ();
397         }
398
399         [MethodImplAttribute (MethodImplOptions.NoInlining)]
400         public static void bp7<T> () {
401         }
402
403         [MethodImplAttribute (MethodImplOptions.NoInlining)]
404         public static void single_stepping () {
405                 bool b = true;
406                 ss1 ();
407                 ss2 ();
408                 ss3 ();
409                 ss3_2 ();
410                 ss4 ();
411                 ss5 (new int [] { 1, 2, 3 }, new Func<int, bool> (is_even));
412                 try {
413                         ss6 (b);
414                 } catch {
415                 }
416                 ss7 ();
417                 ss_nested ();
418                 ss_regress_654694 ();
419                 ss_step_through ();
420                 ss_non_user_code ();
421                 ss_recursive (1);
422                 ss_recursive2 (1);
423                 ss_recursive2 (1);
424                 ss_recursive_chaotic ();
425                 ss_fp_clobber ();
426         }
427
428         [MethodImplAttribute (MethodImplOptions.NoInlining)]
429         public static void ss1 () {
430         }
431
432         [MethodImplAttribute (MethodImplOptions.NoInlining)]
433         public static void ss2 () {
434         }
435
436         [MethodImplAttribute (MethodImplOptions.NoInlining)]
437         public static int ss3 () {
438                 int sum = 0;
439
440                 for (int i = 0; i < 10; ++i)
441                         sum += i;
442
443                 return sum;
444         }
445
446         [MethodImplAttribute (MethodImplOptions.NoInlining)]
447         public static void ss3_2 () {
448                 ss3_2_2 ();
449         }
450
451         [MethodImplAttribute (MethodImplOptions.NoInlining)]
452         public static void ss3_2_2 () {
453         }
454
455         [MethodImplAttribute (MethodImplOptions.NoInlining)]
456         public static int ss4 () {
457                 ss1 (); ss1 ();
458                 ss2 ();
459                 return 0;
460         }
461
462         [MethodImplAttribute (MethodImplOptions.NoInlining)]
463         public static void ss5 (int[] arr, Func<int, bool> selector) {
464                 // Call into linq which calls back into this assembly
465                 arr.Count (selector);
466         }
467
468         [MethodImplAttribute (MethodImplOptions.NoInlining)]
469         public static void ss6 (bool b) {
470                 if (b) {
471                         ss6_2 ();
472                         throw new Exception ();
473                 }
474         }
475
476         [MethodImplAttribute (MethodImplOptions.NoInlining)]
477         public static void ss6_2 () {
478         }
479
480         [MethodImplAttribute (MethodImplOptions.NoInlining)]
481         public static void ss7 () {
482                 try {
483                         ss7_2 ();
484                         ss7_3 ();
485                 } catch {
486                 }
487                 ss7_2 ();
488         }
489
490         [MethodImplAttribute (MethodImplOptions.NoInlining)]
491         public static void ss7_2 () {
492         }
493
494         [MethodImplAttribute (MethodImplOptions.NoInlining)]
495         public static void ss7_3 () {
496                 throw new Exception ();
497         }
498
499         [MethodImplAttribute (MethodImplOptions.NoInlining)]
500         public static void ss_nested () {
501                 ss_nested_1 (ss_nested_2 ());
502                 ss_nested_1 (ss_nested_2 ());
503                 ss_nested_3 ();
504         }
505
506         [MethodImplAttribute (MethodImplOptions.NoInlining)]
507         public static void ss_nested_1 (int i) {
508         }
509
510         [MethodImplAttribute (MethodImplOptions.NoInlining)]
511         public static int ss_nested_2 () {
512                 return 0;
513         }
514
515         [MethodImplAttribute (MethodImplOptions.NoInlining)]
516         public static void ss_nested_3 () {
517         }
518
519         [MethodImplAttribute (MethodImplOptions.NoInlining)]
520         public static void ss_step_through () {
521                 step_through_1 ();
522                 StepThroughClass.step_through_2 ();
523                 step_through_3 ();
524         }
525
526         [DebuggerStepThrough]
527         [MethodImplAttribute (MethodImplOptions.NoInlining)]
528         public static void step_through_1 () {
529         }
530
531         [DebuggerStepThrough]
532         class StepThroughClass {
533                 [MethodImplAttribute (MethodImplOptions.NoInlining)]
534                 public static void step_through_2 () {
535                 }
536         }
537
538         [DebuggerStepThrough]
539         [MethodImplAttribute (MethodImplOptions.NoInlining)]
540         public static void step_through_3 () {
541         }
542
543         [MethodImplAttribute (MethodImplOptions.NoInlining)]
544         public static void ss_non_user_code () {
545                 non_user_code_1 ();
546                 StepNonUserCodeClass.non_user_code_2 ();
547                 non_user_code_3 ();
548         }
549
550         [DebuggerNonUserCode]
551         [MethodImplAttribute (MethodImplOptions.NoInlining)]
552         public static void non_user_code_1 () {
553         }
554
555         [DebuggerNonUserCode]
556         class StepNonUserCodeClass {
557                 [MethodImplAttribute (MethodImplOptions.NoInlining)]
558                 public static void non_user_code_2 () {
559                 }
560         }
561
562         [DebuggerNonUserCode]
563         [MethodImplAttribute (MethodImplOptions.NoInlining)]
564         public static void non_user_code_3 () {
565         }
566
567         [MethodImplAttribute (MethodImplOptions.NoInlining)]
568         public static void ss_recursive (int n) {
569                 if (n == 10)
570                         return;
571                 ss_recursive (n + 1);
572         }
573
574         // Breakpoint will be placed here
575         [MethodImplAttribute (MethodImplOptions.NoInlining)]
576         public static void ss_recursive2_trap ()
577         {
578         }
579
580         public static void ss_recursive2_at (string s)
581         {
582                 // Console.WriteLine (s);
583         }
584
585         // This method is used both for a step over and step out test.
586         [MethodImplAttribute (MethodImplOptions.NoInlining)]
587         public static void ss_recursive2 (int x)
588         {
589                 ss_recursive2_at ( "ss_recursive2 in " + x);
590                 if (x < 10) {
591                         int next = x + 1;
592                         ss_recursive2_at ("ss_recursive2 descend " + x);
593                         ss_recursive2_trap ();
594                         ss_recursive2 (next);
595                 }
596                 ss_recursive2_at ("ss_recursive2 out " + x);
597         }
598
599         // Breakpoint will be placed here
600         [MethodImplAttribute (MethodImplOptions.NoInlining)]
601         public static void ss_recursive_chaotic_trap ()
602         {
603         }
604
605         [MethodImplAttribute (MethodImplOptions.NoInlining)]
606         public static void ss_recursive_chaotic_at (bool exiting, string at, int n)
607         {
608 //              string indent = "";
609 //              for (int count = 12 - n; count > 0; count--)
610 //                      indent += "\t";
611 //              Console.WriteLine (indent + (exiting ? "<--" : "-->") + " " + at + " " + n);
612         }
613
614         [MethodImplAttribute (MethodImplOptions.NoInlining)]
615         public static void ss_recursive_chaotic_fizz (int n)
616         {
617                 ss_recursive_chaotic_at (false, "fizz", n);
618                 if (n > 0) {
619                         int next = n - 1;
620                         ss_recursive_chaotic_buzz (next);
621                         ss_recursive_chaotic_fizzbuzz (next);
622                 } else {
623                         ss_recursive_chaotic_trap ();
624                 }
625                 ss_recursive_chaotic_at (true, "fizz", n);
626         }
627
628         [MethodImplAttribute (MethodImplOptions.NoInlining)]
629         public static void ss_recursive_chaotic_buzz (int n)
630         {
631                 ss_recursive_chaotic_at (false, "buzz", n);
632                 if (n > 0) {
633                         int next = n - 1;
634                         ss_recursive_chaotic_fizz (next);
635                         ss_recursive_chaotic_fizzbuzz (next);
636                 }
637                 ss_recursive_chaotic_at (true, "buzz", n);
638         }
639
640         [MethodImplAttribute (MethodImplOptions.NoInlining)]
641         public static void ss_recursive_chaotic_fizzbuzz (int n)
642         {
643                 ss_recursive_chaotic_at (false, "fizzbuzz", n);
644                 if (n > 0) {
645                         int next = n - 1;
646                         ss_recursive_chaotic_fizz (next);
647                         ss_recursive_chaotic_buzz (next);
648                         ss_recursive_chaotic_fizzbuzz (next);
649                 }
650                 ss_recursive_chaotic_at (true, "fizzbuzz", n);
651         }
652
653         // Call a complex tree of recursive calls that has tripped up "step out" in the past.
654         [MethodImplAttribute (MethodImplOptions.NoInlining)]
655         public static void ss_recursive_chaotic ()
656         {
657                 ss_recursive_chaotic_fizz (12);
658         }
659
660         [MethodImplAttribute (MethodImplOptions.NoInlining)]
661         public static void ss_fp_clobber () {
662                 double v = ss_fp_clobber_1 (5.0);
663                 ss_fp_clobber_2 (v);
664         }
665
666         [MethodImplAttribute (MethodImplOptions.NoInlining)]
667         public static double ss_fp_clobber_1 (double d) {
668                 return d + 2.0;
669         }
670
671         [MethodImplAttribute (MethodImplOptions.NoInlining)]
672         public static void ss_fp_clobber_2 (double d) {
673         }
674
675         [MethodImplAttribute (MethodImplOptions.NoInlining)]
676         public static bool is_even (int i) {
677                 return i % 2 == 0;
678         }
679
680         /*
681                 lock (static_s) {
682                         Console.WriteLine ("HIT!");
683                 }
684                 return 0;
685         }
686         */
687
688         [MethodImplAttribute (MethodImplOptions.NoInlining)]
689         public static void arguments () {
690                 arg1 (SByte.MaxValue - 5, Byte.MaxValue - 5, true, Int16.MaxValue - 5, UInt16.MaxValue - 5, 'F', Int32.MaxValue - 5, UInt32.MaxValue - 5, Int64.MaxValue - 5, UInt64.MaxValue - 5, 1.2345f, 6.78910, new IntPtr (Int32.MaxValue - 5), new UIntPtr (UInt32.MaxValue - 5));
691                 int i = 42;
692                 arg2 ("FOO", null, "BLA", ref i, new GClass <int> { field = 42 }, new object (), '\0'.ToString () + "A");
693                 Tests t = new Tests () { field_i = 42, field_s = "S" };
694                 t.arg3 ("BLA");
695         }
696
697         [MethodImplAttribute (MethodImplOptions.NoInlining)]
698         public static int arg1 (sbyte sb, byte b, bool bl, short s, ushort us, char c, int i, uint ui, long l, ulong ul, float f, double d, IntPtr ip, UIntPtr uip) {
699                 return (int)(sb + b + (bl ? 0 : 1) + s + us + (int)c + i + ui + l + (long)ul + f + d + (int)ip + (int)uip);
700         }
701
702         [MethodImplAttribute (MethodImplOptions.NoInlining)]
703         public static string arg2 (string s, string s3, object o, ref int i, GClass <int> gc, object o2, string s4) {
704                 return s + (s3 != null ? "" : "") + o + i + gc.field + o2;
705         }
706
707         [MethodImplAttribute (MethodImplOptions.NoInlining)]
708         public object arg3 (string s) {
709                 return s + s + s + s + this;
710         }
711
712         [MethodImplAttribute (MethodImplOptions.NoInlining)]
713         public static void objects () {
714                 Tests t = new Tests () { field_i = 42, field_bool1 = true, field_bool2 = false, field_char = 'A', field_byte = 129, field_sbyte = -33, field_short = Int16.MaxValue - 5, field_ushort = UInt16.MaxValue - 5, field_long = Int64.MaxValue - 5, field_ulong = UInt64.MaxValue - 5, field_float = 3.14f, field_double = 3.14f, field_s = "S", base_field_i = 43, base_field_s = "T", field_enum = AnEnum.B, field_class = null, field_intptr = new IntPtr (Int32.MaxValue - 5), field_nullable = null };
715                 t.o1 (new Tests2 () { field_j = 43 }, new GClass <int> { field = 42 }, new GClass <string> { field = "FOO" });
716                 o2 (new string [] { "BAR", "BAZ" }, new int[] { 42, 43 }, new int [,] { { 1, 2 }, { 3, 4 }}, (int[,])Array.CreateInstance (typeof (int), new int [] { 2, 2}, new int [] { 1, 3}), new int[] { 0 });
717         }
718
719         [MethodImplAttribute (MethodImplOptions.NoInlining)]
720         public object o1 (Tests2 t, GClass <int> gc1, GClass <string> gc2) {
721                 if (t == null || gc1 == null || gc2 == null)
722                         return null;
723                 else
724                         return this;
725         }
726
727         [MethodImplAttribute (MethodImplOptions.NoInlining)]
728         public static string o2 (string[] s2, int[] s3, int[,] s4, int[,] s5, IList<int> s6) {
729                 return s2 [0] + s3 [0] + s4 [0, 0] + s6 [0];
730         }
731
732         [MethodImplAttribute (MethodImplOptions.NoInlining)]
733         public static void objrefs () {
734                 Tests t = new Tests () {};
735                 set_child (t);
736                 t.objrefs1 ();
737                 t.child = null;
738                 GC.Collect ();
739                 objrefs2 ();
740         }
741
742         [MethodImplAttribute (MethodImplOptions.NoInlining)]
743         public static void set_child (Tests t) {
744                 t.child = new Tests ();
745         }
746
747         [MethodImplAttribute (MethodImplOptions.NoInlining)]
748         public void objrefs1 () {
749         }
750
751         [MethodImplAttribute (MethodImplOptions.NoInlining)]
752         public static void objrefs2 () {
753         }
754
755         public static void vtypes () {
756                 Tests t = new Tests () { field_struct = new AStruct () { i = 42, s = "S", k = 43 }, generic_field_struct = new GStruct<int> () { i = 42 }, field_boxed_struct = new AStruct () { i = 42 }, boxed_struct_field = new KeyValuePair<int, object> (1, (long)42 ) };
757                 AStruct s = new AStruct { i = 44, s = "T", k = 45 };
758                 AStruct[] arr = new AStruct[] { 
759                         new AStruct () { i = 1, s = "S1" },
760                         new AStruct () { i = 2, s = "S2" } };
761                 TypedReference typedref = __makeref (s);
762                 t.vtypes1 (s, arr, typedref);
763                 vtypes2 (s);
764                 vtypes3 (s);
765                 vtypes4 ();
766         }
767
768         [MethodImplAttribute (MethodImplOptions.NoInlining)]
769         public object vtypes1 (AStruct s, AStruct[] arr, TypedReference typedref) {
770                 if (arr != null)
771                         return this;
772                 else
773                         return null;
774         }
775
776         [MethodImplAttribute (MethodImplOptions.NoInlining)]
777         public static void vtypes2 (AStruct s) {
778                 s.foo (5);
779         }
780
781         [MethodImplAttribute (MethodImplOptions.NoInlining)]
782         public static void vtypes3 (AStruct s) {
783                 AStruct.static_foo (5);
784         }
785
786         [MethodImplAttribute (MethodImplOptions.NoInlining)]
787         public static void vtypes4_2 (IRecStruct o) {
788         }
789
790         [MethodImplAttribute (MethodImplOptions.NoInlining)]
791         public static void vtypes4 () {
792                 IRecStruct s = new RecStruct ();
793                 s.foo (s);
794                 vtypes4_2 (s);
795         }
796
797         [MethodImplAttribute (MethodImplOptions.NoInlining)]
798         public static void locals () {
799                 string s = null;
800                 var astruct = new AStruct () { i = 42 };
801                 locals1 (null);
802                 locals2<string> (null, 5, "ABC", ref s, ref astruct);
803                 locals3 ();
804                 locals6 ();
805                 locals7<int> (22);
806         }
807
808         [MethodImplAttribute (MethodImplOptions.NoInlining)]
809         static void locals11 (double a, ref double b) {
810         }
811
812         [MethodImplAttribute (MethodImplOptions.NoInlining)]
813         public static void locals1 (string[] args) {
814                 long foo = 42;
815
816                 double ri = 1;
817                 locals11 (b: ref ri, a: ri);
818
819                 for (int j = 0; j < 10; ++j) {
820                         foo ++;
821                 }
822         }
823
824         [MethodImplAttribute (MethodImplOptions.NoInlining)]
825 #if NET_4_5
826         [StateMachine (typeof (int))]
827 #endif
828         public static void locals2<T> (string[] args, int arg, T t, ref string rs, ref AStruct astruct) {
829                 long i = 42;
830                 string s = "AB";
831
832                 for (int j = 0; j < 10; ++j) {
833                         if (s != null)
834                                 i ++;
835                         if (t != null)
836                                 i ++;
837                         astruct = new AStruct ();
838                 }
839                 rs = "A";
840                 List<int> alist = new List<int> () { 12 };
841         }
842
843
844         [MethodImplAttribute (MethodImplOptions.NoInlining)]
845         public static void locals3 () {
846                 string s = "B";
847                 s.ToString ();
848
849                 {
850                         long i = 42;
851                         i ++;
852                         locals4 ();
853                 }
854                 {
855                         string i = "A";
856                         i.ToString ();
857                         locals5 ();
858                 }
859                 {
860                         long j = 42;
861                         j ++;
862                 }
863         }
864
865         [MethodImplAttribute (MethodImplOptions.NoInlining)]
866         public static void locals4 () {
867         }
868
869         [MethodImplAttribute (MethodImplOptions.NoInlining)]
870         public static void locals5 () {
871         }
872
873         [MethodImplAttribute (MethodImplOptions.NoInlining)]
874         public static void locals6 () {
875                 int i = 0;
876                 int j = 0;
877                 for (i = 0; i < 10; ++i)
878                         j ++;
879                 sbyte sb = 0;
880                 for (i = 0; i < 10; ++i)
881                         sb ++;
882                 locals6_1 ();
883                 locals6_2 (j);
884                 locals6_3 ();
885                 locals6_4 (j);
886                 locals6_5 ();
887                 locals6_6 (sb);
888         }
889
890         [MethodImplAttribute (MethodImplOptions.NoInlining)]
891         public static void locals6_1 () {
892         }
893
894         [MethodImplAttribute (MethodImplOptions.NoInlining)]
895         public static void locals6_2 (int arg) {
896         }
897
898         [MethodImplAttribute (MethodImplOptions.NoInlining)]
899         public static void locals6_3 () {
900                 // Clobber all registers
901                 int sum = 0, i, j, k, l, m;
902                 for (i = 0; i < 100; ++i)
903                         sum ++;
904                 for (j = 0; j < 100; ++j)
905                         sum ++;
906                 for (k = 0; k < 100; ++k)
907                         sum ++;
908                 for (l = 0; l < 100; ++l)
909                         sum ++;
910                 for (m = 0; m < 100; ++m)
911                         sum ++;
912         }
913
914         [MethodImplAttribute (MethodImplOptions.NoInlining)]
915         public static void locals6_4 (int arg) {
916         }
917
918         [MethodImplAttribute (MethodImplOptions.NoInlining)]
919         public static void locals6_5 () {
920         }
921
922         [MethodImplAttribute (MethodImplOptions.NoInlining)]
923         public static void locals6_6 (int arg) {
924         }
925
926         [MethodImplAttribute (MethodImplOptions.NoInlining)]
927         public static void locals7<T> (T arg) {
928                 T t = arg;
929                 T t2 = t;
930         }
931
932         [MethodImplAttribute (MethodImplOptions.NoInlining)]
933         public static void line_numbers () {
934                 LineNumbers.ln1 ();
935         }
936
937         [MethodImplAttribute (MethodImplOptions.NoInlining)]
938         public static void suspend () {
939                 long i = 5;
940
941                 while (true) {
942                         i ++;
943                 }
944         }
945
946         struct TypedRefTest {
947                 public int MaxValue;
948         }
949
950         [MethodImplAttribute (MethodImplOptions.NoInlining)]
951         public static void type_info () {
952                 Tests t = new Tests () { field_i = 42, field_s = "S", base_field_i = 43, base_field_s = "T", field_enum = AnEnum.B };
953                 t.ti1 (new Tests2 () { field_j = 43 }, new GClass <int> { field = 42 }, new GClass <string> { field = "FOO" });
954                 int val = 0;
955                 unsafe {
956                         AStruct s = new AStruct () { i = 42, s = "S", k = 43 };
957                         TypedRefTest reftest = new TypedRefTest () { MaxValue = 12 };
958                         TypedReference typedref = __makeref (reftest);
959                         ti2 (new string [] { "BAR", "BAZ" }, new int[] { 42, 43 }, new int [,] { { 1, 2 }, { 3, 4 }}, ref val, (int*)IntPtr.Zero, 5, s, new Tests (), new Tests2 (), new GClass <int> (), AnEnum.B, typedref);
960                 }
961         }
962
963         [MethodImplAttribute (MethodImplOptions.NoInlining)]
964         public object ti1 (Tests2 t, GClass <int> gc1, GClass <string> gc2) {
965                 if (t == null || gc1 == null || gc2 == null)
966                         return null;
967                 else
968                         return this;
969         }
970
971         [MethodImplAttribute (MethodImplOptions.NoInlining)]
972         public static unsafe string ti2 (string[] s2, int[] s3, int[,] s4, ref int ri, int* ptr, int i, AStruct s, Tests t, Tests2 t2, GClass<int> g, AnEnum ae, TypedReference typedref) {
973                 return s2 [0] + s3 [0] + s4 [0, 0];
974         }
975
976         [MethodImplAttribute (MethodImplOptions.NoInlining)]
977         public static void assembly_load () {
978                 assembly_load_2 ();
979         }
980
981         [MethodImplAttribute (MethodImplOptions.NoInlining)]
982         public static void assembly_load_2 () {
983                 // This will load System.dll while holding the loader lock
984                 new Foo ();
985         }
986
987         [MethodImplAttribute (MethodImplOptions.NoInlining)]
988         public static void invoke () {
989                 new Tests ().invoke1 (new Tests2 (), new AStruct () { i = 42, j = (IntPtr)43 }, new GStruct<int> { j = 42 });
990                 new Tests ().invoke_ex ();
991         }
992
993         [MethodImplAttribute (MethodImplOptions.NoInlining)]
994         public void invoke1 (Tests2 t, AStruct s, GStruct<int> g) {
995                 invoke2 ();
996         }
997
998         [MethodImplAttribute (MethodImplOptions.NoInlining)]
999         public void invoke2 () {
1000         }
1001
1002         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1003         public void invoke_ex () {
1004                 invoke_ex_inner ();
1005         }
1006
1007         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1008         public void invoke_ex_inner () {
1009                 try {
1010                         throw new Exception ();
1011                 } catch {
1012                 }
1013         }
1014
1015         int counter;
1016
1017         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1018         public void invoke_single_threaded () {
1019                 // Spawn a thread incrementing a counter
1020                 bool finished = false;
1021
1022                 new Thread (delegate () {
1023                                 while (!finished)
1024                                         counter ++;
1025                 }).Start ();
1026
1027                 Thread.Sleep (100);
1028
1029                 invoke_single_threaded_2 ();
1030
1031                 finished = true;
1032         }
1033
1034         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1035         public void invoke_single_threaded_2 () {
1036         }
1037
1038         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1039         public void invoke_abort () {
1040         }
1041
1042         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1043         public void invoke_abort_2 () {
1044                 Thread.Sleep (1000000);
1045         }
1046
1047         public void invoke_return_void () {
1048         }
1049
1050         public string invoke_return_ref () {
1051                 return "ABC";
1052         }
1053
1054         public object invoke_return_null () {
1055                 return null;
1056         }
1057
1058         public int invoke_return_primitive () {
1059                 return 42;
1060         }
1061
1062         public int? invoke_return_nullable () {
1063                 return 42;
1064         }
1065
1066         public int? invoke_return_nullable_null () {
1067                 return null;
1068         }
1069
1070         public void invoke_type_load () {
1071                 new Class3 ();
1072         }
1073
1074         class Class3 {
1075         }
1076
1077         public long invoke_pass_primitive (byte ub, sbyte sb, short ss, ushort us, int i, uint ui, long l, ulong ul, char c, bool b, float f, double d) {
1078                 return ub + sb + ss + us + i + ui + l + (long)ul + (int)c + (b ? 1 : 0) + (int)f + (int)d;
1079         }
1080
1081         public int invoke_pass_primitive2 (bool b) {
1082                 return b ? 1 : 0;
1083         }
1084
1085         public string invoke_pass_ref (string s) {
1086                 return s;
1087         }
1088
1089         public static string invoke_static_pass_ref (string s) {
1090                 return s;
1091         }
1092
1093         public static void invoke_static_return_void () {
1094         }
1095
1096         public static void invoke_throws () {
1097                 throw new Exception ();
1098         }
1099
1100         public int invoke_iface () {
1101                 return 42;
1102         }
1103
1104         public void invoke_out (out int foo, out int[] arr) {
1105                 foo = 5;
1106                 arr = new int [10];
1107         }
1108
1109         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1110         public static void exceptions () {
1111                 try {
1112                         throw new OverflowException ();
1113                 } catch (Exception) {
1114                 }
1115                 try {
1116                         throw new OverflowException ();
1117                 } catch (Exception) {
1118                 }
1119                 try {
1120                         throw new ArgumentException ();
1121                 } catch (Exception) {
1122                 }
1123                 try {
1124                         throw new OverflowException ();
1125                 } catch (Exception) {
1126                 }
1127                 // no subclasses
1128                 try {
1129                         throw new OverflowException ();
1130                 } catch (Exception) {
1131                 }
1132                 try {
1133                         throw new Exception ();
1134                 } catch (Exception) {
1135                 }
1136
1137                 object o = null;
1138                 try {
1139                         o.GetType ();
1140                 } catch (Exception) {
1141                 }
1142
1143                 try {
1144                         exceptions2 ();
1145                 } catch (Exception) {
1146                 }
1147         }
1148
1149         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1150         public static void unhandled_exception () {
1151                 ThreadPool.QueueUserWorkItem (delegate {
1152                                 throw new InvalidOperationException ();
1153                         });
1154                 Thread.Sleep (10000);
1155         }
1156
1157         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1158         public static void unhandled_exception_endinvoke_2 () {
1159         }
1160
1161         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1162         public static void unhandled_exception_endinvoke () {
1163                         Action action = new Action (() => 
1164                         {
1165                                 throw new Exception ("thrown");
1166                         });
1167                         action.BeginInvoke ((ar) => {
1168                                 try {
1169                                         action.EndInvoke (ar);
1170                                 } catch (Exception ex) {
1171                                         //Console.WriteLine (ex);
1172                                 }
1173                         }, null);
1174                 Thread.Sleep (1000);
1175                 unhandled_exception_endinvoke_2 ();
1176         }
1177
1178         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1179         public static void unhandled_exception_user () {
1180 #if NET_4_5
1181                 System.Threading.Tasks.Task.Factory.StartNew (() => {
1182                                 Throw ();
1183                         });
1184                 Thread.Sleep (10000);
1185 #endif
1186         }
1187
1188         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1189         public static void Throw () {
1190                 throw new Exception ();
1191         }
1192
1193         internal static Delegate create_filter_delegate (Delegate dlg, MethodInfo filter_method)
1194         {
1195                 if (dlg == null)
1196                         throw new ArgumentNullException ();
1197                 if (dlg.Target != null)
1198                         throw new ArgumentException ();
1199                 if (dlg.Method == null)
1200                         throw new ArgumentException ();
1201
1202                 var ret_type = dlg.Method.ReturnType;
1203                 var param_types = dlg.Method.GetParameters ().Select (x => x.ParameterType).ToArray ();
1204
1205                 var dynamic = new DynamicMethod (Guid.NewGuid ().ToString (), ret_type, param_types, typeof (object), true);
1206                 var ig = dynamic.GetILGenerator ();
1207
1208                 LocalBuilder retval = null;
1209                 if (ret_type != typeof (void))
1210                         retval = ig.DeclareLocal (ret_type);
1211
1212                 var label = ig.BeginExceptionBlock ();
1213
1214                 for (int i = 0; i < param_types.Length; i++)
1215                         ig.Emit (OpCodes.Ldarg, i);
1216                 ig.Emit (OpCodes.Call, dlg.Method);
1217
1218                 if (retval != null)
1219                         ig.Emit (OpCodes.Stloc, retval);
1220
1221                 ig.Emit (OpCodes.Leave, label);
1222
1223                 ig.BeginExceptFilterBlock ();
1224
1225                 ig.Emit (OpCodes.Call, filter_method);
1226
1227                 ig.BeginCatchBlock (null);
1228
1229                 ig.Emit (OpCodes.Pop);
1230
1231                 ig.EndExceptionBlock ();
1232
1233                 if (retval != null)
1234                         ig.Emit (OpCodes.Ldloc, retval);
1235
1236                 ig.Emit (OpCodes.Ret);
1237
1238                 return dynamic.CreateDelegate (dlg.GetType ());
1239         }
1240
1241         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1242         static void exception_filter_method () {
1243                 throw new InvalidOperationException ();
1244         }
1245
1246         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1247         static int exception_filter_filter (Exception exc) {
1248                 return 1;
1249         }
1250
1251         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1252         public static void exception_filter () {
1253                 var method = typeof (Tests).GetMethod (
1254                         "exception_filter_method", BindingFlags.NonPublic | BindingFlags.Static);
1255                 var filter_method = typeof (Tests).GetMethod (
1256                         "exception_filter_filter", BindingFlags.NonPublic | BindingFlags.Static);
1257
1258                 var dlg = Delegate.CreateDelegate (typeof (Action), method);
1259
1260                 var wrapper = (Action) create_filter_delegate (dlg, filter_method);
1261
1262                 wrapper ();
1263         }
1264
1265         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1266         public static bool return_true () {
1267                 return true;
1268         }
1269
1270         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1271         public static void exceptions2 () {
1272                 if (return_true ())
1273                         throw new Exception ();
1274                 Console.WriteLine ();
1275         }
1276
1277         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1278         public static void threads () {
1279                 Thread t = new Thread (delegate () {});
1280
1281                 t.Start ();
1282                 t.Join ();
1283         }
1284
1285         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1286         public static void domains () {
1287                 AppDomain domain = AppDomain.CreateDomain ("domain");
1288
1289                 CrossDomain o = (CrossDomain)domain.CreateInstanceAndUnwrap (
1290                                    typeof (CrossDomain).Assembly.FullName, "CrossDomain");
1291
1292                 domains_print_across (o);
1293
1294                 domains_2 (o, new CrossDomain ());
1295
1296                 o.invoke_2 ();
1297
1298                 o.invoke ();
1299
1300                 o.invoke_2 ();
1301
1302                 AppDomain.Unload (domain);
1303
1304                 domains_3 ();
1305
1306                 typeof (Tests).GetMethod ("called_from_invoke").Invoke (null, null);
1307         }
1308
1309         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1310         public static void called_from_invoke () {
1311         }
1312
1313         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1314         public static void domains_2 (object o, object o2) {
1315         }
1316
1317         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1318         public static void domains_print_across (object o) {
1319         }
1320
1321         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1322         public static void domains_3 () {
1323         }
1324
1325         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1326         public static void invoke_in_domain () {
1327         }
1328
1329         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1330         public static void invoke_in_domain_2 () {
1331         }
1332
1333         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1334         public static void dynamic_methods () {
1335                 var m = new DynamicMethod ("dyn_method", typeof (void), new Type []  { typeof (int) }, typeof (object).Module);
1336                 var ig = m.GetILGenerator ();
1337
1338                 ig.Emit (OpCodes.Ldstr, "FOO");
1339                 ig.Emit (OpCodes.Call, typeof (Tests).GetMethod ("dyn_call"));
1340                 ig.Emit (OpCodes.Ret);
1341
1342                 var del = (Action<int>)m.CreateDelegate (typeof (Action<int>));
1343
1344                 del (0);
1345         }
1346
1347         public static void dyn_call (string s) {
1348         }
1349
1350         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1351         public static void ref_emit () {
1352                 AssemblyName assemblyName = new AssemblyName ();
1353                 assemblyName.Name = "foo";
1354
1355                 AssemblyBuilder assembly =
1356                         Thread.GetDomain ().DefineDynamicAssembly (
1357                                                                                                            assemblyName, AssemblyBuilderAccess.RunAndSave);
1358
1359                 ModuleBuilder module = assembly.DefineDynamicModule ("foo.dll");
1360
1361                 TypeBuilder tb = module.DefineType ("foo", TypeAttributes.Public, typeof (object));
1362                 MethodBuilder mb = tb.DefineMethod ("ref_emit_method", MethodAttributes.Public|MethodAttributes.Static, CallingConventions.Standard, typeof (void), new Type [] { });
1363                 ILGenerator ig = mb.GetILGenerator ();
1364                 ig.Emit (OpCodes.Ldstr, "FOO");
1365                 ig.Emit (OpCodes.Call, typeof (Tests).GetMethod ("ref_emit_call"));
1366                 ig.Emit (OpCodes.Ret);
1367
1368                 Type t = tb.CreateType ();
1369
1370                 t.GetMethod ("ref_emit_method").Invoke (null, null);
1371         }
1372
1373         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1374         public static void ref_emit_call (string s) {
1375         }
1376
1377         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1378         public static void frames_in_native () {
1379                 Thread.Sleep (500);
1380                 var evt = new ManualResetEvent (false);
1381                 
1382                 object mon = new object ();
1383                 ThreadPool.QueueUserWorkItem (delegate {
1384                                 frames_in_native_2 ();
1385                                 evt.Set ();
1386                         });
1387                 evt.WaitOne ();
1388         }
1389
1390         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1391         static void frames_in_native_2 () {
1392                 frames_in_native_3 ();
1393         }
1394
1395         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1396         static void frames_in_native_3 () {
1397         }
1398
1399         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1400         public static void string_call (string s) {
1401         }
1402
1403         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1404         public static void ss_regress_654694 () {
1405                 if (true) {
1406                         string h = "hi";
1407                         string_call (h);
1408                 }
1409         }
1410
1411         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1412         public static void user () {
1413                 Debugger.Break ();
1414
1415                 Debugger.Log (5, Debugger.IsLogging () ? "A" : "", "B");
1416         }
1417
1418         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1419         public static void type_load () {
1420                 type_load_2 ();
1421         }
1422
1423         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1424         static void type_load_2 () {
1425                 var c1 = new Dictionary<int, int> ();
1426                 c1.ToString ();
1427                 var c = new TypeLoadClass ();
1428                 c.ToString ();
1429                 var c2 = new TypeLoadClass2 ();
1430                 c2.ToString ();
1431         }
1432
1433         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1434         public static void regress () {
1435                 regress_2755 (DateTime.Now);
1436         }
1437
1438         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1439         public static unsafe void regress_2755 (DateTime d) {
1440                 int* buffer = stackalloc int [128];
1441
1442                 regress_2755_2 ();
1443
1444                 int sum = 0;
1445                 for (int i = 0; i < 128; ++i)
1446                         sum += buffer [i];
1447
1448                 regress_2755_3 (sum);
1449         }
1450
1451         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1452         public static void regress_2755_2 () {
1453         }
1454
1455         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1456         public static void regress_2755_3 (int sum) {
1457         }
1458
1459         static object gc_suspend_field;
1460
1461         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1462         static unsafe void set_gc_suspend_field () {
1463                 set_gc_suspend_field_2 ();
1464                 // Clear stack
1465                 int* buffer = stackalloc int [4096];
1466         }
1467
1468         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1469         static void set_gc_suspend_field_2 () {
1470                 gc_suspend_field = new object ();
1471         }
1472
1473         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1474         static void gc_suspend_1 () {
1475         }
1476
1477         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1478         public static void gc_suspend_invoke () {
1479                 gc_suspend_field = null;
1480                 GC.Collect ();
1481                 GC.WaitForPendingFinalizers ();
1482         }
1483
1484         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1485         public static void gc_suspend () {
1486                 set_gc_suspend_field ();
1487                 gc_suspend_1 ();
1488         }
1489
1490         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1491         public static void generic_method<T> () where T : class {
1492         }
1493
1494         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1495         public void evaluate_method_2 () {
1496         }
1497
1498         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1499         public void evaluate_method () {
1500                 field_i = 42;
1501                 evaluate_method_2 ();
1502         }
1503
1504         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1505         static void set_ip_1 () {
1506         }
1507
1508         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1509         static void set_ip_2 () {
1510         }
1511
1512         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1513         public static void set_ip () {
1514                 int i = 0, j;
1515
1516                 i ++;
1517                 i ++;
1518                 set_ip_1 ();
1519                 i ++;
1520                 j = 5;
1521                 set_ip_2 ();
1522         }
1523
1524         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1525         public static void step_filters () {
1526                 ClassWithCctor.cctor_filter ();
1527         }
1528
1529         class ClassWithCctor {
1530                 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1531                 static ClassWithCctor () {
1532                         int i = 1;
1533                         int j = 2;
1534                 }
1535
1536                 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1537                 public static void cctor_filter () {
1538                 }
1539         }
1540
1541         public override string virtual_method () {
1542                 return "V2";
1543         }
1544 }
1545
1546 class TypeLoadClass {
1547 }
1548
1549 class TypeLoadClass2 {
1550 }
1551
1552 public class SentinelClass : MarshalByRefObject {
1553 }
1554
1555 public class CrossDomain : MarshalByRefObject
1556 {
1557         SentinelClass printMe = new SentinelClass ();
1558
1559         public void invoke () {
1560                 Tests.invoke_in_domain ();
1561         }
1562
1563         public void invoke_2 () {
1564                 Tests.invoke_in_domain_2 ();
1565         }
1566
1567         public int invoke_3 () {
1568                 return 42;
1569         }
1570 }       
1571
1572 public class Foo
1573 {
1574         public ProcessStartInfo info;
1575 }
1576
1577 // Class used for line number info testing, don't change its layout
1578 public class LineNumbers
1579 {
1580         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1581         public static void ln1 () {
1582                 // Column 3
1583                 ln2 ();
1584                 ln3 ();
1585         }
1586
1587         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1588         public static void ln2 () {
1589         }
1590
1591         [MethodImplAttribute (MethodImplOptions.NoInlining)]
1592         public static void ln3 () {
1593 #pragma warning disable 0219
1594                 int i = 5;
1595 #pragma warning restore 0219
1596                 #line 55 "FOO"
1597         }
1598 }
1599
1600 class LocalReflectClass
1601 {
1602         public static void RunMe ()
1603         {
1604                 var reflectMe = new someClass ();
1605                 reflectMe.someMethod ();
1606         }
1607
1608         class someClass : ContextBoundObject
1609         {
1610                 public object someField;
1611
1612                 public void someMethod ()
1613                 {
1614                 }
1615         }
1616 }
1617
1618