Initial set of Ward sgen annotations (#5705)
[mono.git] / mono / tests / stackframes-async.2.cs
index b28f1f6e8da2c8ca7b7eb6311ac741acb0699e5c..61342fee15282d5bf51b8538b61c064128710363 100644 (file)
@@ -2,8 +2,6 @@ using System;
 using System.Net;
 using System.Diagnostics;
 
-namespace stacktracetest
-{
        class MainClass
        {
                static int frame_count = 0;
@@ -11,7 +9,11 @@ namespace stacktracetest
                {
                        AsyncCallback cback = new AsyncCallback(ResolveCallback);
                        IAsyncResult res = Dns.BeginGetHostEntry("localhost", cback, null);
-                       System.Threading.Thread.Sleep(2000);
+                       for (int i = 0; i < 100; ++i) {
+                               if (frame_count != 0)
+                                       break;
+                               System.Threading.Thread.Sleep(100);
+                       }
                        /*
                         * seems to be broken
                        while (!res.IsCompleted) {
@@ -19,9 +21,13 @@ namespace stacktracetest
                        };
                        IPHostEntry ip = Dns.EndGetHostEntry (res);
                        Console.WriteLine (ip);*/
-                       if (frame_count > 1)
-                               return 0;
-                       return 1;
+                       if (frame_count < 1)
+                               return 1;
+
+                       // A test for #444383
+                       AppDomain.CreateDomain("1").CreateInstance(typeof (Class1).Assembly.GetName ().Name, "Class1");
+
+                       return 0;
                }
                
                public static void ResolveCallback(IAsyncResult ar)
@@ -36,4 +42,17 @@ namespace stacktracetest
                    Console.WriteLine("ResolveCallback() complete");
                }
        }
+
+public class Class1
+{
+       public Class1 () {
+               AppDomain.CreateDomain("2").CreateInstance(typeof (Class1).Assembly.GetName ().Name, "Class2");
+       }
+}
+
+public class Class2
+{
+       public Class2 () {
+               new StackTrace(true);
+       }
 }