[netcore] Ongoing work. (#13391)
[mono-project.git] / mono / tests / bug-60862.cs
blob251838f584dddca33afeea099288e4c2e017f6ba
1 /* https://bugzilla.xamarin.com/show_bug.cgi?id=60862 */
2 using System;
3 using System.Threading;
5 namespace StackOverflowTest
7 class Program
9 static bool fault = false;
10 static Exception ex = null;
12 public static int Main(string[] args)
14 Thread t = new Thread (Run);
15 t.Start ();
16 t.Join ();
17 if (fault) {
18 if (ex == null) {
19 Console.WriteLine ("fault occured, but no exception object available");
20 return 1;
21 } else {
22 bool is_stackoverlfow = ex is StackOverflowException;
23 Console.WriteLine ("fault occured: ex = " + is_stackoverlfow);
24 return is_stackoverlfow ? 0 : 3;
27 Console.WriteLine("no fault");
28 return 2;
31 static void Run()
33 try {
34 Execute ();
35 } catch(Exception e) {
36 ex = e;
37 fault = true;
41 static void Execute ()
43 WaitOne ();
46 static bool WaitOne (bool killProcessOnInterrupt = false, bool throwOnInterrupt = false)
48 try {
49 return WaitOne();
50 } catch(ThreadInterruptedException e) { }
51 return false;