2 using System.Reflection;
4 using System.Collections.Generic;
5 using System.Threading;
7 internal class GenericType<T> {
9 internal static object static_var;
11 public static void AccessStaticVar ()
13 if (static_var != null && static_var.GetType () != typeof (List<T>))
14 throw new Exception ("Corrupted static var");
15 GenericType<T>.static_var = new List<T> ();
19 public static class Program {
20 private static bool stress;
22 /* Create a lot of static vars */
23 private static void CreateVTables ()
25 Type[] nullArgs = new Type[0];
26 Assembly ass = Assembly.GetAssembly (typeof (int));
27 foreach (Type type in ass.GetTypes ()) {
29 Type inst = typeof (GenericType<>).MakeGenericType (type);
30 Activator.CreateInstance (inst);
36 private static void StressStaticFieldAddr ()
39 GenericType<object>.AccessStaticVar ();
43 public static void Main (string[] args)
45 Thread thread = new Thread (StressStaticFieldAddr);