2 using System.Diagnostics;
3 using System.Threading;
4 using System.Threading.Tasks;
6 class CustomException : Exception
12 /* expected exit code: 0 */
13 static void Main (string[] args)
15 ManualResetEvent mre = new ManualResetEvent (false);
17 var t = Task.Factory.StartNew (new Action (() => { try { throw new CustomException (); } finally { mre.Set (); } }));
19 if (!mre.WaitOne (5000))
25 } catch (AggregateException ae) {
26 if (!(ae.InnerExceptions [0] is CustomException))
28 } catch (Exception ex) {
29 Console.WriteLine (ex);