2 using System.Threading;
3 using System.Runtime.InteropServices;
7 delegate int SimpleDelegate (int a);
9 static int cb_state = 0;
13 Console.WriteLine ("Test.F from delegate: " + a);
14 throw new NotImplementedException ("F");
17 static void async_callback (IAsyncResult ar)
19 Console.WriteLine ("Async Callback " + ar.AsyncState);
25 SimpleDelegate d = new SimpleDelegate (F);
26 AsyncCallback ac = new AsyncCallback (async_callback);
27 string state1 = "STATE1";
30 // Call delegate via ThreadPool and check that the exception is rethrown correctly
31 IAsyncResult ar1 = d.BeginInvoke (1, ac, state1);
37 res = d.EndInvoke (ar1);
38 Console.WriteLine ("NO EXCEPTION");
40 } catch (NotImplementedException) {
41 Console.WriteLine ("received exception ... OK");