2 using System
.Reflection
;
3 using System
.Threading
;
7 public static void Bla ()
9 //DoDomainUnload is invoked as part of the unload sequence, so let's pre jit it here to increase the likehood
11 var m
= typeof (AppDomain
).GetMethod ("DoDomainUnload", BindingFlags
.Instance
| BindingFlags
.NonPublic
);
13 m
.MethodHandle
.GetFunctionPointer ();
17 static ManualResetEvent evt
= new ManualResetEvent (false);
19 static void UnloadIt ()
21 //AppDomain.Unload calls AppDomain::getDomainId () before calling into the runtime, so let's pre jit
22 //it here to increase the likehood of hanging
25 AppDomain
.Unload (ad
);
29 AppDomain
.Unload (AppDomain
.CreateDomain ("Warmup unload code"));
30 Console
.WriteLine (".");
31 ad
= AppDomain
.CreateDomain ("NewDomain");
33 var t
= new Thread (UnloadIt
);
34 t
.IsBackground
= true;