Reduce TLS accesses. (#11487)
[mono-project.git] / mono / tests / unhandled-exception-6.cs
blob7ed54d333006cfbf8d83185ffc7d5b9d720d9369
1 using System;
2 using System.Diagnostics;
3 using System.Threading;
4 using System.Threading.Tasks;
5 using System.Runtime.Remoting.Messaging;
7 class CustomException : Exception
11 class Driver
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);
22 Thread.Sleep (5000);
24 Environment.Exit (1);
27 static void Delegate ()
29 throw new CustomException ();
32 static void Callback (IAsyncResult iares)
34 ((Action) ((AsyncResult) iares).AsyncDelegate).EndInvoke (iares);