2010-06-17 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / tests / stackframes-async.2.cs
bloba984554a9d0aa010e44e99d24081802b48b1e7bb
1 using System;
2 using System.Net;
3 using System.Diagnostics;
5 class MainClass
7 static int frame_count = 0;
8 public static int Main(string[] args)
10 AsyncCallback cback = new AsyncCallback(ResolveCallback);
11 IAsyncResult res = Dns.BeginGetHostEntry("localhost", cback, null);
12 System.Threading.Thread.Sleep(2000);
14 * seems to be broken
15 while (!res.IsCompleted) {
16 System.Threading.Thread.Sleep(20);
18 IPHostEntry ip = Dns.EndGetHostEntry (res);
19 Console.WriteLine (ip);*/
20 if (frame_count < 1)
21 return 1;
23 // A test for #444383
24 AppDomain.CreateDomain("1").CreateInstance(typeof (Class1).Assembly.GetName ().Name, "Class1");
26 return 0;
29 public static void ResolveCallback(IAsyncResult ar)
31 Console.WriteLine("ResolveCallback()");
32 StackTrace st = new StackTrace();
33 frame_count = st.FrameCount;
34 for(int i = 0; i < st.FrameCount; i++) {
35 StackFrame sf = st.GetFrame(i);
36 Console.WriteLine("method: {0}", sf.GetMethod());
38 Console.WriteLine("ResolveCallback() complete");
42 public class Class1
44 public Class1 () {
45 AppDomain.CreateDomain("2").CreateInstance(typeof (Class1).Assembly.GetName ().Name, "Class2");
49 public class Class2
51 public Class2 () {
52 new StackTrace(true);