View | Details | Raw Unified | Return to bug 537414
Collapse All | Expand All

(-)security/MiscTest.cs (+30 lines)
Lines 27-37 Link Here
27
//
27
//
28
28
29
using System;
29
using System;
30
using System.Security;
31
using System.Runtime.CompilerServices;
30
using System.Windows;
32
using System.Windows;
31
33
32
using Mono.Moonlight.UnitTesting;
34
using Mono.Moonlight.UnitTesting;
33
using Microsoft.VisualStudio.TestTools.UnitTesting;
35
using Microsoft.VisualStudio.TestTools.UnitTesting;
34
36
37
// this icall exists on both mono and sl
38
// note: CSC prefer this type when compiling this assembly, while SMCS prefers the original type from mscorlib.dll
39
namespace System.Runtime.CompilerServices {
40
	public class RuntimeHelpers {
41
42
		[MethodImpl (MethodImplOptions.InternalCall)]
43
		public static extern object GetObjectValue (object obj);
44
	}
45
}
46
35
namespace MoonTest.Security {
47
namespace MoonTest.Security {
36
48
37
	[TestClass]
49
	[TestClass]
Lines 66-71 Link Here
66
			AppDomainManager [,] adm = new AppDomainManager [0, 0];
78
			AppDomainManager [,] adm = new AppDomainManager [0, 0];
67
			Assert.IsNotNull (adm, "AppDomainManager[,]");
79
			Assert.IsNotNull (adm, "AppDomainManager[,]");
68
		}
80
		}
81
82
		[TestMethod]
83
		[ExpectedException (typeof (SecurityException))]
84
		[MoonlightBug ("smcs compiles this as using mscorlib, while csc compile this using the newly defined type")]
85
		public void RedefineNonCriticalInternalCall ()
86
		{
87
			RuntimeHelpers.GetObjectValue (null);
88
		}
89
90
		[MethodImpl (MethodImplOptions.InternalCall)]
91
		static extern void NonExistingInternalCall ();
92
93
		[TestMethod]
94
		[ExpectedException (typeof (SecurityException))]
95
		public void DefineNonExistingInternalCall ()
96
		{
97
			NonExistingInternalCall ();
98
		}
69
	}
99
	}
70
}
100
}
71
101

Return to bug 537414