2 using System.Threading;
4 public class MultiThreadExceptionTest {
6 public static int result = 0;
8 public static void ThreadStart1 () {
9 Console.WriteLine("{0} started",
10 Thread.CurrentThread.Name);
17 Console.WriteLine ("Count: " + i++);
20 } catch (ThreadAbortException e) {
21 Console.WriteLine ("cought exception level 2 " + e.ExceptionState);
22 Console.WriteLine (e);
23 if ((string)e.ExceptionState == "STATETEST")
28 } catch (ThreadAbortException e) {
29 Console.WriteLine ("cought exception level 1 " + e.ExceptionState);
30 Console.WriteLine (e);
31 if (e.ExceptionState == null)
34 } catch (Exception e) {
35 Console.WriteLine ("cought exception level 0");
36 Console.WriteLine (e);
42 } catch (System.Threading.ThreadStateException e) {
46 Console.WriteLine ("end");
50 public static int Main() {
51 Thread t1 = new Thread(new ThreadStart
52 (MultiThreadExceptionTest.ThreadStart1));
59 //Thread t0 = Thread.CurrentThread;
63 t1.Abort ("STATETEST");
66 Console.WriteLine ("Result: " + result);