2 using System
.Threading
;
6 static ManualResetEvent mre
= new ManualResetEvent (false);
10 AppDomain
.CurrentDomain
.UnhandledException
+= OnUnhandledException
;
11 WaitCallback wcb
= new WaitCallback ((a
) => {
12 Thread
.CurrentThread
.Abort();
15 wcb
.BeginInvoke (wcb
, OnCBFinished
, null);
17 if (!mre
.WaitOne (10000))
21 GC
.WaitForPendingFinalizers ();
23 /* expected exit code: 255 */
28 static void OnUnhandledException (object sender
, UnhandledExceptionEventArgs e
)
30 string str
= e
.ExceptionObject
.ToString ();
31 if (!str
.Contains ("From OnCBFinished")) {
36 if (!e
.IsTerminating
) {
44 static void OnCBFinished (object arg
)
46 throw new Exception ("From OnCBFinished");