[System.ServiceModel] Prevent crash in Dispatcher.ListenerLoopManager… (#7136)
[mono-project.git] / mono / tests / generic-stack-traces2.2.cs
bloba051365508c299c60ab6f94422f732ffe2e6e111
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 public static int test_0_nongeneric_subclass () {
37 return new D ().foo ();
40 static void Test<TT> (object test)
42 Console.WriteLine (typeof (Gen<TT>).ToString ());
43 Console.WriteLine (System.Environment.StackTrace);