// Paolo Molaro (lupus@ximian.com)
//
// (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
// 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 {
[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) {
+ throw;
} catch (TargetException) {
throw;
} catch (Exception e) {
get;
}
#endif
+
+#if NET_2_0
+ public override MethodBody GetMethodBody () {
+ return GetMethodBody (mhandle);
+ }
+#endif
}
internal class MonoCMethod : ConstructorInfo, ISerializable\r
*/
[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) {
+ throw;
} catch (TargetException) {
throw;
} catch (Exception e) {
}
#endif
+#if NET_2_0
+ public override MethodBody GetMethodBody () {
+ return GetMethodBody (mhandle);
+ }
+#endif
+
public override string ToString () {
string parms = "";
ParameterInfo[] p = GetParameters ();