[xbuild] ToolTask - make error column check a little non-specific.
[mono.git] / mcs / tests / test-106.cs
1 using System;
2 using System.Threading;
3 using System.Runtime.InteropServices;
4
5 class Test
6 {
7         delegate int SimpleDelegate (int a);
8
9         static int cb_state = 0;
10
11         static int F (int a)
12         {
13                 Console.WriteLine ("Test.F from delegate: " + a);
14                 throw new NotImplementedException ("F");
15         }
16
17         static void async_callback (IAsyncResult ar)
18         {
19                 Console.WriteLine ("Async Callback " + ar.AsyncState);
20                 cb_state = 1;
21         }
22
23         static int Main ()
24         {
25                 SimpleDelegate d = new SimpleDelegate (F);
26                 AsyncCallback ac = new AsyncCallback (async_callback);
27                 string state1 = "STATE1";
28                 int res = 0;
29
30                 // Call delegate via ThreadPool and check that the exception is rethrown correctly
31                 IAsyncResult ar1 = d.BeginInvoke (1, ac, state1);
32
33                 while (cb_state == 0)
34                         Thread.Sleep (0);
35
36                 try {
37                         res = d.EndInvoke (ar1);
38                         Console.WriteLine ("NO EXCEPTION");
39                         return 1;
40                 } catch (NotImplementedException) {
41                         Console.WriteLine ("received exception ... OK");
42                 }
43
44                 return 0;
45         }
46 }