2 using System
.Diagnostics
;
3 using System
.Threading
;
4 using System
.Threading
.Tasks
;
5 using System
.Runtime
.Remoting
.Messaging
;
7 class CustomException
: Exception
13 /* expected exit code: 255 */
14 static void Main (string[] args
)
16 if (Environment
.GetEnvironmentVariable ("TEST_UNHANDLED_EXCEPTION_HANDLER") != null)
17 AppDomain
.CurrentDomain
.UnhandledException
+= (s
, e
) => {};
19 var action
= new Action (Delegate
);
20 var ares
= action
.BeginInvoke (Callback
, null);
27 static void Delegate ()
29 throw new CustomException ();
32 static void Callback (IAsyncResult iares
)
34 ((Action
) ((AsyncResult
) iares
).AsyncDelegate
).EndInvoke (iares
);