Test case for bugs #80724 and #79717.
authorPaolo Molaro <lupus@oddwiz.org>
Wed, 14 Feb 2007 17:40:04 +0000 (17:40 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Wed, 14 Feb 2007 17:40:04 +0000 (17:40 -0000)
svn path=/trunk/mono/; revision=72847

mono/tests/Makefile.am
mono/tests/stackframes-async.2.cs [new file with mode: 0644]

index bee0d962ce25d8b8d8ef5f156ac3b829f86ab407..151bdc1f5020a616bc83b9167f1cef26bec152b2 100644 (file)
@@ -277,6 +277,7 @@ TEST_CS2_SRC = \
        catch-generics.2.cs     \
        event-get.2.cs          \
        safehandle.2.cs         \
+       stackframes-async.2.cs          \
        module-cctor-loader.2.cs        \
        bug-80392.2.cs
 
diff --git a/mono/tests/stackframes-async.2.cs b/mono/tests/stackframes-async.2.cs
new file mode 100644 (file)
index 0000000..b28f1f6
--- /dev/null
@@ -0,0 +1,39 @@
+using System;
+using System.Net;
+using System.Diagnostics;
+
+namespace stacktracetest
+{
+       class MainClass
+       {
+               static int frame_count = 0;
+               public static int Main(string[] args)
+               {
+                       AsyncCallback cback = new AsyncCallback(ResolveCallback);
+                       IAsyncResult res = Dns.BeginGetHostEntry("localhost", cback, null);
+                       System.Threading.Thread.Sleep(2000);
+                       /*
+                        * seems to be broken
+                       while (!res.IsCompleted) {
+                               System.Threading.Thread.Sleep(20);
+                       };
+                       IPHostEntry ip = Dns.EndGetHostEntry (res);
+                       Console.WriteLine (ip);*/
+                       if (frame_count > 1)
+                               return 0;
+                       return 1;
+               }
+               
+               public static void ResolveCallback(IAsyncResult ar)
+               {
+                   Console.WriteLine("ResolveCallback()");
+                   StackTrace st = new StackTrace();
+                   frame_count = st.FrameCount;
+                   for(int i = 0; i < st.FrameCount; i++) {
+                       StackFrame sf = st.GetFrame(i);
+                       Console.WriteLine("method: {0}", sf.GetMethod());
+                   }
+                   Console.WriteLine("ResolveCallback() complete");
+               }
+       }
+}