Merge pull request #2006 from steffen-kiess/posix-sockets-2
[mono.git] / mono / tests / unhandled-exception-2.cs
1 using System;
2 using System.Diagnostics;
3 using System.Threading;
4 using System.Threading.Tasks;
5
6 class CustomException : Exception
7 {
8 }
9
10 class Driver
11 {
12         /* expected exit code: 0 */
13         static void Main (string[] args)
14         {
15                 ManualResetEvent mre = new ManualResetEvent (false);
16
17                 var a = new Action (() => { try { throw new CustomException (); } finally { mre.Set (); } });
18                 var ares = a.BeginInvoke (null, null);
19
20                 if (!mre.WaitOne (5000))
21                         Environment.Exit (2);
22
23                 try {
24                         a.EndInvoke (ares);
25                         Environment.Exit (4);
26                 } catch (CustomException) {
27                 } catch (Exception ex) {
28                         Console.WriteLine (ex);
29                         Environment.Exit (3);
30                 }
31
32                 Environment.Exit (0);
33         }
34 }