Author: spouliot
Date: 2005-03-11 08:10:43 -0500 (Fri, 11 Mar 2005)
New Revision: 41692
Modified:
trunk/mcs/class/corlib/System.Reflection/ChangeLog
trunk/mcs/class/corlib/System.Reflection/MonoMethod.cs
Log:
2005-03-11 Sebastien Pouliot <[EMAIL PROTECTED]>
* MonoMethod.cs: Promote a LinkDemand (if present) to a full Demand
(i.e. stack walk) when reflection is being used to invoke a method.
Modified: trunk/mcs/class/corlib/System.Reflection/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/ChangeLog 2005-03-11 13:09:04 UTC
(rev 41691)
+++ trunk/mcs/class/corlib/System.Reflection/ChangeLog 2005-03-11 13:10:43 UTC
(rev 41692)
@@ -1,3 +1,8 @@
+2005-03-11 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * MonoMethod.cs: Promote a LinkDemand (if present) to a full Demand
+ (i.e. stack walk) when reflection is being used to invoke a method.
+
2005-02-24 Carlos Alberto Cortez <[EMAIL PROTECTED]>
* Assembly.cs: LoadFrom: Change signature to support reflection only
Modified: trunk/mcs/class/corlib/System.Reflection/MonoMethod.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection/MonoMethod.cs 2005-03-11
13:09:04 UTC (rev 41691)
+++ trunk/mcs/class/corlib/System.Reflection/MonoMethod.cs 2005-03-11
13:10:43 UTC (rev 41692)
@@ -6,11 +6,8 @@
// Paolo Molaro ([EMAIL PROTECTED])
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
-
-//
-// Copyright (C) 2004 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
// "Software"), to deal in the Software without restriction, including
@@ -31,11 +28,11 @@
// 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.Runtime.Serialization;
+using System.Security;
namespace System.Reflection {
@@ -110,12 +107,21 @@
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern Object InternalInvoke (Object obj, Object[]
parameters);
- public override Object Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+ public override Object Invoke (Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
+ {
if (binder == null)
binder = Binder.DefaultBinder;
ParameterInfo[] pinfo = GetParameters ();
if (!Binder.ConvertArgs (binder, parameters, pinfo,
culture))
throw new ArgumentException ("parameters");
+
+ if (SecurityManager.SecurityEnabled) {
+ // sadly Attributes doesn't tell us which kind
of security action this is so
+ // we must do it the hard way - and it also
means that we can skip calling
+ // Attribute (which is another an icall)
+ SecurityManager.ReflectedLinkDemandInvoke
(this);
+ }
+
try {
return InternalInvoke (obj, parameters);
} catch (InvalidOperationException) {
@@ -309,13 +315,22 @@
*/
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern Object InternalInvoke (Object obj, Object[]
parameters);
-
- public override Object Invoke (Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
+
+ public override Object Invoke (Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
+ {
if (binder == null)
binder = Binder.DefaultBinder;
ParameterInfo[] pinfo = GetParameters ();
if (!Binder.ConvertArgs (binder, parameters, pinfo,
culture))
throw new ArgumentException ("parameters");
+
+ if (SecurityManager.SecurityEnabled) {
+ // sadly Attributes doesn't tell us which kind
of security action this is so
+ // we must do it the hard way - and it also
means that we can skip calling
+ // Attribute (which is another an icall)
+ SecurityManager.ReflectedLinkDemandInvoke
(this);
+ }
+
try {
return InternalInvoke (obj, parameters);
} catch (InvalidOperationException) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches