[netcore] Disable a flaky test on interpreter (#18904)
[mono-project.git] / mono / tests / bug-333798-tb.2.cs
blob669163656fccb9f53a4774e2573c8608c90722fb
1 using System;
2 using System.Threading;
3 using System.Reflection;
4 using System.Reflection.Emit;
5 using System.IO;
6 using System.Security;
7 using System.Security.Permissions;
8 using System.Runtime.InteropServices;
9 using System.Collections.Generic;
11 public class Gen<T> {
12 public static Gen<T>[] newSelfArr () {
13 return null;
17 public class Driver {
18 public static void Test () {
19 Gen<int>.newSelfArr ();
23 public class GenericsTests
25 static AssemblyBuilder assembly;
26 static ModuleBuilder module;
28 static void SetUp ()
30 AssemblyName assemblyName = new AssemblyName ();
31 assemblyName.Name = "TestAssembly";
32 assembly =
33 Thread.GetDomain ().DefineDynamicAssembly (
34 assemblyName, AssemblyBuilderAccess.RunAndSave, ".");
35 module = assembly.DefineDynamicModule ("module1", "TestModuleSS.dll");
38 public static int Main () {
39 SetUp ();
40 TypeBuilder tb = module.DefineType ("Gen", TypeAttributes.Public);
41 Type[] args = tb.DefineGenericParameters ("T");
42 Type oi = tb.MakeGenericType (args);
44 MethodBuilder mb = tb.DefineMethod ("Test", MethodAttributes.Public | MethodAttributes.Static, oi.MakeArrayType (), new Type [0]);
46 ILGenerator il = mb.GetILGenerator();
47 il.Emit (OpCodes.Ldnull);
48 il.Emit (OpCodes.Ret);
49 tb.CreateType ();
51 TypeBuilder main = module.DefineType ("Driver", TypeAttributes.Public);
52 MethodBuilder mb2 = main.DefineMethod ("Test", MethodAttributes.Public | MethodAttributes.Static);
54 il = mb2.GetILGenerator();
55 il.Emit (OpCodes.Call, TypeBuilder.GetMethod (tb.MakeGenericType (typeof (int)), mb));
56 il.Emit (OpCodes.Pop);
57 il.Emit (OpCodes.Ret);
58 Type tt = main.CreateType ();
60 tt.GetMethod ("Test").Invoke (null, null);
61 //typeof (Driver).GetMethod ("Test").Invoke (null, null);
62 return 0;