2010-04-07 Rodrigo Kumpera <rkumpera@novell.com>
[mono-project.git] / mono / tests / delegate-delegate-exception.cs
blob029b955f76e60298700d18b745e376219bc82c90
1 using System;
2 using System.Threading;
3 using System.Runtime.InteropServices;
5 class foo {
6 delegate void foo_delegate ();
8 static void function () {
9 Console.WriteLine ("Delegate method");
10 throw new SystemException("delegate throws exception");
13 static void async_callback (IAsyncResult ar)
15 Console.WriteLine ("Async callback " + ar.AsyncState);
18 public static void Main () {
19 foo_delegate d = new foo_delegate (function);
20 AsyncCallback ac = new AsyncCallback (async_callback);
21 IAsyncResult ar1 = d.BeginInvoke (ac, "foo");
23 ar1.AsyncWaitHandle.WaitOne();
24 d.EndInvoke(ar1);
26 Thread.Sleep(1000);
27 Console.WriteLine("Main returns");