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 ThreadPool.QueueUserWorkItem (_ => { try { throw new CustomException (); } finally { mre.Set (); } });
19 if (!mre.WaitOne (5000))
22 /* Give a chance to the threadpool thread to finish executing the exception
23 * unwinding after the finally, before we exit with status 0 on the current thread */