2 using System.Runtime.CompilerServices;
7 // private internal call for Mono runtime
8 public class Environment {
10 [MethodImplAttribute (MethodImplOptions.InternalCall)]
11 public extern static string internalGetGacPath ();
14 // private internal call for MS runtime
15 // http://msdn.microsoft.com/msdnmag/issues/04/11/NETMatters/
22 [MethodImpl (MethodImplOptions.InternalCall)]
24 public extern void CompleteGuid ();
26 public extern bool CompleteGuid ();
31 public class Program {
33 static bool RunningOnMono ()
35 bool mono = (Type.GetType ("Mono.Math.BigInteger") != null);
36 Console.WriteLine ("Running on {0} runtime...", mono ? "Mono" : "Microsoft");
44 if (RunningOnMono ()) {
45 result = Environment.internalGetGacPath ();
47 System.Guid g = new System.Guid ();
52 result = g.CompleteGuid ().ToString ();
56 Console.WriteLine ("*0* Expected internal call: {0}", result);
58 Console.WriteLine ("*0* Unexpected (1.x) but accepted (like 2.x) internal call: {0}", result);
62 catch (SecurityException se) {
64 Console.WriteLine ("*1* Unexpected SecurityException\n{0}", se);
67 Console.WriteLine ("*0* Expected (1.x) SecurityException\n{0}", se);
72 Console.WriteLine ("*2* Unexpected exception\n{0}", e);