Merge pull request #2582 from ludovic-henry/fix-threadpool-starvation
[mono.git] / mono / tests / unhandled-exception-6.cs
1 using System;
2 using System.Diagnostics;
3 using System.Threading;
4 using System.Threading.Tasks;
5 using System.Runtime.Remoting.Messaging;
6
7 class CustomException : Exception
8 {
9 }
10
11 class Driver
12 {
13         /* expected exit code: 0 */
14         static void Main (string[] args)
15         {
16                 var action = new Action (Delegate);
17                 var ares = action.BeginInvoke (Callback, null);
18
19                 Thread.Sleep (5000);
20
21                 Environment.Exit (1);
22         }
23
24         static void Delegate ()
25         {
26                 throw new CustomException ();
27         }
28
29         static void Callback (IAsyncResult iares)
30         {
31                 ((Action) ((AsyncResult) iares).AsyncDelegate).EndInvoke (iares);
32         }
33 }