Fix potential crash for Encoder.Convert (#20522)
[mono-project.git] / mono / profiler / test-pinvokes.cs
blobc476d55db91e3f2484b7b63c5d76be9de1dcd541
1 using System;
2 using System.Runtime.InteropServices;
3 using System.Runtime.CompilerServices;
5 public class MonoPInvokeCallbackAttribute : Attribute {
6 public MonoPInvokeCallbackAttribute (Type delegateType) { }
9 public class T {
10 private static bool fired;
12 [MonoPInvokeCallback (typeof (Action))]
13 private static void CallBack ()
15 Console.WriteLine ("Called back");
16 fired = true;
19 [DllImport ("proftest_pinvokes", EntryPoint="test_reverse_pinvoke")]
20 private static extern void test_reverse_pinvoke (Action cb);
23 public static int Main ()
25 Helper ();
26 if (fired)
27 return 0;
28 else
29 return 1;
33 [MethodImpl (MethodImplOptions.NoInlining)]
34 private static void Helper ()
36 test_reverse_pinvoke (new Action (CallBack));