[runtime] Require C# namespace to be quoted.
[mono-project.git] / mono / tests / stackframes-async.2.cs
blob61342fee15282d5bf51b8538b61c064128710363
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 for (int i = 0; i < 100; ++i) {
13 if (frame_count != 0)
14 break;
15 System.Threading.Thread.Sleep(100);
18 * seems to be broken
19 while (!res.IsCompleted) {
20 System.Threading.Thread.Sleep(20);
22 IPHostEntry ip = Dns.EndGetHostEntry (res);
23 Console.WriteLine (ip);*/
24 if (frame_count < 1)
25 return 1;
27 // A test for #444383
28 AppDomain.CreateDomain("1").CreateInstance(typeof (Class1).Assembly.GetName ().Name, "Class1");
30 return 0;
33 public static void ResolveCallback(IAsyncResult ar)
35 Console.WriteLine("ResolveCallback()");
36 StackTrace st = new StackTrace();
37 frame_count = st.FrameCount;
38 for(int i = 0; i < st.FrameCount; i++) {
39 StackFrame sf = st.GetFrame(i);
40 Console.WriteLine("method: {0}", sf.GetMethod());
42 Console.WriteLine("ResolveCallback() complete");
46 public class Class1
48 public Class1 () {
49 AppDomain.CreateDomain("2").CreateInstance(typeof (Class1).Assembly.GetName ().Name, "Class2");
53 public class Class2
55 public Class2 () {
56 new StackTrace(true);