Fix lookup for all SourceLink mappings, prefer local file over SourceLink
[mono-project.git] / mono / tests / threadpool-exceptions2.cs
blob17988c5441dfad940ff07463472cbe1785578917
1 using System;
2 using System.Threading;
4 class Test {
6 static ManualResetEvent mre = new ManualResetEvent (false);
8 static int Main ()
10 AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
11 WaitCallback wcb = new WaitCallback ((a) => {
12 throw new Exception ("From the threadpoool");
13 });
14 wcb.BeginInvoke (wcb, OnCBFinished, null);
16 if (!mre.WaitOne (10000))
17 return 2;
19 GC.Collect ();
20 GC.WaitForPendingFinalizers ();
22 /* expected exit code: 255 */
23 Thread.Sleep (10000);
24 return 0;
27 static void OnUnhandledException (object sender, UnhandledExceptionEventArgs e)
29 string str = e.ExceptionObject.ToString ();
30 if (!str.Contains ("From OnCBFinished")) {
31 Environment.Exit (3);
32 return;
35 if (!e.IsTerminating) {
36 Environment.Exit (4);
37 return;
40 mre.Set ();
43 static void OnCBFinished (object arg)
45 throw new Exception ("From OnCBFinished");