update readme (#21797)
[mono-project.git] / mono / tests / generic-stack-traces2.2.cs
blob6f3493c9e3a3e55765d4550cc3290f364626ae58
1 using System;
2 using System.Threading;
3 using System.Runtime.CompilerServices;
4 using System.Diagnostics;
6 namespace GetStackTrace
8 class Gen<T> {}
10 class C<T>
12 [MethodImplAttribute (MethodImplOptions.NoInlining)]
13 public int foo () {
14 return new StackTrace ().GetFrame (0).GetMethod ().DeclaringType.IsGenericTypeDefinition ? 1 : 0;
18 class D : C<string>
22 class Program
24 static int Main (string[] args)
26 Thread t = new Thread (new ParameterizedThreadStart (Test<string>));
27 t.Start (null);
28 t.Join ();
30 if (test_0_nongeneric_subclass () != 0)
31 return 1;
32 return 0;
35 /* Test for gshared methods declared in a generic subclass of a nongeneric class */
36 [MethodImplAttribute (MethodImplOptions.NoInlining)]
37 public static int test_0_nongeneric_subclass () {
38 return new D ().foo ();
41 static void Test<TT> (object test)
43 Console.WriteLine (typeof (Gen<TT>).ToString ());
44 Console.WriteLine (System.Environment.StackTrace);