Jelajahi Sumber

2005-09-25 Sebastien Pouliot <[email protected]>

	* MonoProperty.cs: Invoke throws a SecurityException but GetValue must
	throw TargetInvocationException with the SecurityException as an inner
	exception. See CAS unit tests for System.Web.dll.


svn path=/trunk/mcs/; revision=50728
Sebastien Pouliot 20 tahun lalu
induk
melakukan
3b6ef30ed0

+ 6 - 0
mcs/class/corlib/System.Reflection/ChangeLog

@@ -1,3 +1,9 @@
+2005-09-25  Sebastien Pouliot  <[email protected]>
+
+	* MonoProperty.cs: Invoke throws a SecurityException but GetValue must
+	throw TargetInvocationException with the SecurityException as an inner
+	exception. See CAS unit tests for System.Web.dll.
+
 2005-09-20  Martin Baulig  <[email protected]>
 
 	* Assembly.cs: Removed some unused debugger icalls.

+ 12 - 10
mcs/class/corlib/System.Reflection/MonoProperty.cs

@@ -7,10 +7,7 @@
 //   Patrik Torstensson ([email protected])
 //
 // (C) 2001 Ximian, Inc.  http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -32,10 +29,10 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Globalization;
 using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
+using System.Security;
 
 namespace System.Reflection {
 	
@@ -200,11 +197,16 @@ namespace System.Reflection {
 			MethodInfo method = GetGetMethod (true);
 			if (method == null)
 				throw new ArgumentException ("Get Method not found for '" + Name + "'");
-			
-			if (index == null || index.Length == 0) 
-				ret = method.Invoke (obj, invokeAttr, binder, null, culture);
-			else
-				ret = method.Invoke (obj, invokeAttr, binder, index, culture);
+
+			try {
+				if (index == null || index.Length == 0) 
+					ret = method.Invoke (obj, invokeAttr, binder, null, culture);
+				else
+					ret = method.Invoke (obj, invokeAttr, binder, index, culture);
+			}
+			catch (SecurityException se) {
+				throw new TargetInvocationException (se);
+			}
 
 			return ret;
 		}