Merge branch 'xml-fixes' of https://github.com/myeisha/mono into myeisha-xml-fixes
[mono.git] / mono / tests / threadpool-exceptions4.cs
1 using System;
2 using System.Threading;
3
4 class Test {
5         static int Main ()
6         {
7                 AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
8                 WaitCallback wcb = new WaitCallback ((a) => {
9                         throw new Exception ("From the threadpoool");
10                 });
11                 wcb.BeginInvoke (wcb, OnCBFinished, null);
12                 Thread.Sleep (1000);
13                 return 1;
14         }
15
16         static void OnCBFinished (object arg)
17         {
18                 throw new Exception ("From OnCBFinished");
19         }
20
21         static void OnUnhandledException (object sender, UnhandledExceptionEventArgs e)
22         {
23                 Environment.Exit (0);
24         }
25 }
26