Add assert when dllmap is disabled and fix support build in netcore mode
[mono-project.git] / mono / tests / appdomain-threadpool-unload.cs
blobd8a7049af779af59bb9a99ee3b75a9a7044fd889
2 using System;
3 using System.Linq;
4 using System.Threading;
6 class Driver
8 class ThreadPoolLauncherObject
10 public volatile int i = 0;
12 public ThreadPoolLauncherObject ()
14 ThreadPool.QueueUserWorkItem (_ => { for (int i = 0; i < 10 * 1000 * 1000; ++i); }, null);
18 public static void Main ()
20 int count = 0;
21 object o = new object ();
23 foreach (var i in
24 Enumerable.Range (0, 100)
25 .AsParallel ().WithDegreeOfParallelism (Environment.ProcessorCount)
26 .Select (i => {
27 AppDomain ad;
29 ad = AppDomain.CreateDomain ("testdomain" + i);
30 ad.CreateInstance (typeof (ThreadPoolLauncherObject).Assembly.FullName, typeof (ThreadPoolLauncherObject).FullName);
32 Thread.Sleep (10);
34 AppDomain.Unload (ad);
36 return i;
38 .Select (i => {
39 lock (o) {
40 count += 1;
42 Console.Write (".");
43 if (count % 25 == 0)
44 Console.WriteLine ();
47 return i;
49 ) {