X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Ftests%2Ftest-106.cs;h=c4d7a7761b505c380f27b8ae9045281d832f2336;hb=3faab8f47e80134530ff8810bcfa68847c309b39;hp=52b5f61d9f1690d9d22b27392ee0c8d34754afa0;hpb=881f83658281916d8f0784df7c726ecb7cc289db;p=mono.git diff --git a/mcs/tests/test-106.cs b/mcs/tests/test-106.cs index 52b5f61d9f1..c4d7a7761b5 100644 --- a/mcs/tests/test-106.cs +++ b/mcs/tests/test-106.cs @@ -2,49 +2,45 @@ using System; using System.Threading; using System.Runtime.InteropServices; -class Test { +class Test +{ delegate int SimpleDelegate (int a); static int cb_state = 0; - - static int F (int a) { + + static int F (int a) + { Console.WriteLine ("Test.F from delegate: " + a); - throw new NotImplementedException (); + throw new NotImplementedException ("F"); } static void async_callback (IAsyncResult ar) { Console.WriteLine ("Async Callback " + ar.AsyncState); cb_state = 1; - throw new NotImplementedException (); } - - static int Main () { + + static int Main () + { SimpleDelegate d = new SimpleDelegate (F); AsyncCallback ac = new AsyncCallback (async_callback); string state1 = "STATE1"; int res = 0; - + + // Call delegate via ThreadPool and check that the exception is rethrown correctly IAsyncResult ar1 = d.BeginInvoke (1, ac, state1); - ar1.AsyncWaitHandle.WaitOne (); + while (cb_state == 0) + Thread.Sleep (0); try { res = d.EndInvoke (ar1); + Console.WriteLine ("NO EXCEPTION"); + return 1; } catch (NotImplementedException) { - res = 1; Console.WriteLine ("received exception ... OK"); } - while (cb_state == 0) - Thread.Sleep (0); - - if (cb_state != 1) - return 1; - - if (res != 1) - return 2; - return 0; } }