diff options
Diffstat (limited to 'mcs/class')
22 files changed, 114 insertions, 70 deletions
diff --git a/mcs/class/corlib/System.Diagnostics/StackTrace.cs b/mcs/class/corlib/System.Diagnostics/StackTrace.cs index edd6a79d841..c9bb574a216 100644 --- a/mcs/class/corlib/System.Diagnostics/StackTrace.cs +++ b/mcs/class/corlib/System.Diagnostics/StackTrace.cs @@ -200,7 +200,7 @@ namespace System.Diagnostics { sb.AppendFormat ("{0}.{1}", method.DeclaringType.FullName, method.Name); /* Append parameter information */ sb.Append ("("); - ParameterInfo[] p = method.GetParameters (); + ParameterInfo[] p = method.GetParametersInternal (); for (int j = 0; j < p.Length; ++j) { if (j > 0) sb.Append (", "); diff --git a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs index c0586b55402..e53cdbb097e 100644 --- a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs @@ -859,7 +859,7 @@ namespace System.Reflection.Emit */ if ((entry_point != null) && entry_point.DeclaringType.Module != mainModule) { Type[] paramTypes; - if (entry_point.GetParameters ().Length == 1) + if (entry_point.GetParametersCount () == 1) paramTypes = new Type [] { typeof (string) }; else paramTypes = Type.EmptyTypes; diff --git a/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs index 2391dc8be2c..b0e6747bedf 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/ConstructorBuilder.cs @@ -120,10 +120,10 @@ namespace System.Reflection.Emit { return GetParametersInternal (); } - internal ParameterInfo [] GetParametersInternal () + internal override ParameterInfo [] GetParametersInternal () { if (parameters == null) - return new ParameterInfo [0]; + return EmptyArray<ParameterInfo>.Value; ParameterInfo [] retval = new ParameterInfo [parameters.Length]; for (int i = 0; i < parameters.Length; i++) @@ -133,7 +133,7 @@ namespace System.Reflection.Emit { return retval; } - internal override int GetParameterCount () + internal override int GetParametersCount () { if (parameters == null) return 0; @@ -232,7 +232,7 @@ namespace System.Reflection.Emit { public ParameterBuilder DefineParameter (int iSequence, ParameterAttributes attributes, string strParamName) { - if (iSequence < 1 || iSequence > GetParameterCount ()) + if (iSequence < 1 || iSequence > GetParametersCount ()) throw new ArgumentOutOfRangeException ("iSequence"); if (type.is_created) throw not_after_created (); diff --git a/mcs/class/corlib/System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs b/mcs/class/corlib/System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs index ea3cee589d0..1f7b30dbce5 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs +++ b/mcs/class/corlib/System.Reflection.Emit/ConstructorOnTypeBuilderInst.cs @@ -104,6 +104,11 @@ namespace System.Reflection.Emit if (!instantiation.IsCreated) throw new NotSupportedException (); + return GetParametersInternal (); + } + + internal override ParameterInfo[] GetParametersInternal () + { ParameterInfo [] res; if (cb is ConstructorBuilder) { ConstructorBuilder cbuilder = (ConstructorBuilder)cb; @@ -129,9 +134,9 @@ namespace System.Reflection.Emit } } - internal override int GetParameterCount () + internal override int GetParametersCount () { - return cb.GetParameterCount (); + return cb.GetParametersCount (); } public override Object Invoke (Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) diff --git a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs index 862420a6cc0..647736bf203 100644 --- a/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/CustomAttributeBuilder.cs @@ -148,7 +148,7 @@ namespace System.Reflection.Emit { throw new ArgumentNullException ("namedFields"); if (fieldValues == null) throw new ArgumentNullException ("fieldValues"); - if (con.GetParameterCount () != constructorArgs.Length) + if (con.GetParametersCount () != constructorArgs.Length) throw new ArgumentException ("Parameter count does not match " + "passed in argument value count."); if (namedProperties.Length != propertyValues.Length) @@ -532,7 +532,8 @@ namespace System.Reflection.Emit { ConstructorBuilder cb = ctor as ConstructorBuilder; if (cb != null) return cb.GetParametersInternal (); - return ctor.GetParameters (); + + return ctor.GetParametersInternal (); } } } diff --git a/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs b/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs index 931573d5449..0e87b8a340f 100644 --- a/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs +++ b/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs @@ -245,9 +245,15 @@ namespace System.Reflection.Emit { return MethodImplAttributes.IL | MethodImplAttributes.Managed; } - public override ParameterInfo[] GetParameters () { + public override ParameterInfo[] GetParameters () + { + return GetParametersInternal (); + } + + internal override ParameterInfo[] GetParametersInternal () + { if (parameters == null) - return new ParameterInfo [0]; + return EmptyArray<ParameterInfo>.Value; ParameterInfo[] retval = new ParameterInfo [parameters.Length]; for (int i = 0; i < parameters.Length; i++) { @@ -256,7 +262,7 @@ namespace System.Reflection.Emit { return retval; } - internal override int GetParameterCount () + internal override int GetParametersCount () { return parameters == null ? 0 : parameters.Length; } @@ -297,7 +303,7 @@ namespace System.Reflection.Emit { public override string ToString () { string parms = String.Empty; - ParameterInfo[] p = GetParameters (); + ParameterInfo[] p = GetParametersInternal (); for (int i = 0; i < p.Length; ++i) { if (i > 0) parms = parms + ", "; diff --git a/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs b/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs index 2172b1e63f1..1c9c3f4c3d1 100644 --- a/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs +++ b/mcs/class/corlib/System.Reflection.Emit/ILGenerator.cs @@ -525,7 +525,7 @@ namespace System.Reflection.Emit { emit_int (token); if (opcode.StackBehaviourPop == StackBehaviour.Varpop) - cur_stack -= con.GetParameterCount (); + cur_stack -= con.GetParametersCount (); } public virtual void Emit (OpCode opcode, double arg) @@ -744,7 +744,7 @@ namespace System.Reflection.Emit { cur_stack ++; if (opcode.StackBehaviourPop == StackBehaviour.Varpop) - cur_stack -= meth.GetParameterCount (); + cur_stack -= meth.GetParametersCount (); } private void Emit (OpCode opcode, MethodInfo method, int token) @@ -762,7 +762,7 @@ namespace System.Reflection.Emit { cur_stack ++; if (opcode.StackBehaviourPop == StackBehaviour.Varpop) - cur_stack -= method.GetParameterCount (); + cur_stack -= method.GetParametersCount (); } [CLSCompliant(false)] diff --git a/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs index 1beb945a8d2..f898bce399e 100644 --- a/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs @@ -219,6 +219,12 @@ namespace System.Reflection.Emit { if (!type.is_created) throw NotSupported (); + + return GetParametersInternal (); + } + + internal override ParameterInfo[] GetParametersInternal () + { if (parameters == null) return null; @@ -229,7 +235,7 @@ namespace System.Reflection.Emit return retval; } - internal override int GetParameterCount () + internal override int GetParametersCount () { if (parameters == null) return 0; diff --git a/mcs/class/corlib/System.Reflection.Emit/MethodOnTypeBuilderInst.cs b/mcs/class/corlib/System.Reflection.Emit/MethodOnTypeBuilderInst.cs index aa19ecef3bf..1384f9971e4 100644 --- a/mcs/class/corlib/System.Reflection.Emit/MethodOnTypeBuilderInst.cs +++ b/mcs/class/corlib/System.Reflection.Emit/MethodOnTypeBuilderInst.cs @@ -164,6 +164,11 @@ namespace System.Reflection.Emit public override ParameterInfo [] GetParameters () { + return GetParametersInternal (); + } + + internal override ParameterInfo [] GetParametersInternal () + { throw new NotSupportedException (); } @@ -173,9 +178,9 @@ namespace System.Reflection.Emit } } - internal override int GetParameterCount () + internal override int GetParametersCount () { - return base_method.GetParameterCount (); + return base_method.GetParametersCount (); } public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) diff --git a/mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs b/mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs index dc9ca4073ee..aa24bc34719 100644 --- a/mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs +++ b/mcs/class/corlib/System.Reflection.Emit/MonoArrayMethod.cs @@ -79,12 +79,18 @@ namespace System.Reflection { } [MonoTODO("Not implemented. Always returns an empty array")] - public override ParameterInfo[] GetParameters() { - return new ParameterInfo [0]; + public override ParameterInfo[] GetParameters() + { + return GetParametersInternal (); } + + internal override ParameterInfo[] GetParametersInternal () + { + return EmptyArray<ParameterInfo>.Value; + } [MonoTODO("Not implemented. Always returns 0")] - internal override int GetParameterCount () + internal override int GetParametersCount () { return 0; } diff --git a/mcs/class/corlib/System.Reflection.Emit/PropertyOnTypeBuilderInst.cs b/mcs/class/corlib/System.Reflection.Emit/PropertyOnTypeBuilderInst.cs index 578cf06a5d1..1035f494c86 100644 --- a/mcs/class/corlib/System.Reflection.Emit/PropertyOnTypeBuilderInst.cs +++ b/mcs/class/corlib/System.Reflection.Emit/PropertyOnTypeBuilderInst.cs @@ -115,7 +115,8 @@ namespace System.Reflection.Emit MethodInfo method = GetGetMethod (true); if (method != null) return method.GetParameters (); - return new ParameterInfo [0]; + + return EmptyArray<ParameterInfo>.Value; } public override MethodInfo GetSetMethod (bool nonPublic) diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs index 462717057cc..882d125442d 100644 --- a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs @@ -1459,7 +1459,7 @@ namespace System.Reflection.Emit throw new Exception ("Error in customattr"); } - var ctor_type = customBuilder.Ctor is ConstructorBuilder ? ((ConstructorBuilder)customBuilder.Ctor).parameters[0] : customBuilder.Ctor.GetParameters()[0].ParameterType; + var ctor_type = customBuilder.Ctor is ConstructorBuilder ? ((ConstructorBuilder)customBuilder.Ctor).parameters[0] : customBuilder.Ctor.GetParametersInternal()[0].ParameterType; int pos = 6; if (ctor_type.FullName == "System.Int16") pos = 4; diff --git a/mcs/class/corlib/System.Reflection/Binder.cs b/mcs/class/corlib/System.Reflection/Binder.cs index 6d186c73edd..e6a1b202186 100644 --- a/mcs/class/corlib/System.Reflection/Binder.cs +++ b/mcs/class/corlib/System.Reflection/Binder.cs @@ -122,8 +122,8 @@ namespace System.Reflection // If the argument types differ we // have an ambigous match, as well if (matchId >= 0) { - ParameterInfo[] p1 = m.GetParameters (); - ParameterInfo[] p2 = match [matchId].GetParameters (); + ParameterInfo[] p1 = m.GetParametersInternal (); + ParameterInfo[] p2 = match [matchId].GetParametersInternal (); bool equal = true; if (p1.Length != p2.Length) @@ -181,7 +181,7 @@ namespace System.Reflection MethodBase selected = null; if (names != null) { foreach (var m in match) { - var parameters = m.GetParameters (); + var parameters = m.GetParametersInternal (); int i; /* @@ -234,7 +234,7 @@ namespace System.Reflection // probably belongs in ReorderArgumentArray static void AdjustArguments (MethodBase selected, ref object [] args) { - var parameters = selected.GetParameters (); + var parameters = selected.GetParametersInternal (); var parameters_length = parameters.Length; if (parameters_length == 0) return; @@ -268,7 +268,7 @@ namespace System.Reflection { object [] newArgs = new object [args.Length]; Array.Copy (args, newArgs, args.Length); - ParameterInfo [] plist = selected.GetParameters (); + ParameterInfo [] plist = selected.GetParametersInternal (); for (int n = 0; n < names.Length; n++) for (int p = 0; p < plist.Length; p++) { if (names [n] == plist [p].Name) { @@ -480,9 +480,10 @@ namespace System.Reflection MethodBase exact_match = null; for (i = 0; i < match.Length; ++i) { m = match [i]; - ParameterInfo[] args = m.GetParameters (); - if (args.Length != types.Length) + if (m.GetParametersCount () != types.Length) continue; + + ParameterInfo[] args = m.GetParametersInternal (); for (j = 0; j < types.Length; ++j) { if (types [j] != args [j].ParameterType) break; @@ -504,10 +505,11 @@ namespace System.Reflection for (i = 0; i < match.Length; ++i) { m = match [i]; - var pi = m.GetParameters (); - if (pi.Length == 0 || pi.Length > types.Length + 1) + var count = m.GetParametersCount (); + if (count == 0 || count > types.Length + 1) continue; + var pi = m.GetParametersInternal (); if (!Attribute.IsDefined (pi [pi.Length - 1], typeof (ParamArrayAttribute))) continue; @@ -531,7 +533,7 @@ namespace System.Reflection MethodBase result = null; for (i = 0; i < match.Length; ++i) { m = match [i]; - ParameterInfo[] args = m.GetParameters (); + ParameterInfo[] args = m.GetParametersInternal (); if (args.Length != types.Length) continue; if (!check_arguments (types, args, allowByRefMatch)) @@ -550,7 +552,7 @@ namespace System.Reflection // REVIEW: do we also need to implement best method match? for (i = 0; i < match.Length; ++i) { m = match [i]; - ParameterInfo[] methodArgs = m.GetParameters (); + ParameterInfo[] methodArgs = m.GetParametersInternal (); if (methodArgs.Length != types.Length) continue; for (j = 0; j < types.Length; ++j) { @@ -578,8 +580,8 @@ namespace System.Reflection MethodBase GetBetterMethod (MethodBase m1, MethodBase m2, Type [] types) { - ParameterInfo [] pl1 = m1.GetParameters (); - ParameterInfo [] pl2 = m2.GetParameters (); + ParameterInfo [] pl1 = m1.GetParametersInternal (); + ParameterInfo [] pl2 = m2.GetParametersInternal (); int prev = 0; for (int i = 0; i < pl1.Length; i++) { int cmp = CompareCloserType (pl1 [i].ParameterType, pl2 [i].ParameterType); diff --git a/mcs/class/corlib/System.Reflection/EventInfo.cs b/mcs/class/corlib/System.Reflection/EventInfo.cs index ec28771bc8f..f2f69b7707e 100644 --- a/mcs/class/corlib/System.Reflection/EventInfo.cs +++ b/mcs/class/corlib/System.Reflection/EventInfo.cs @@ -50,15 +50,16 @@ namespace System.Reflection { get { ParameterInfo[] p; MethodInfo add = GetAddMethod (true); - p = add.GetParameters (); + p = add.GetParametersInternal (); if (p.Length > 0) { Type t = p [0].ParameterType; /* is it alwasys the first arg? if (!t.IsSubclassOf (typeof (System.Delegate))) throw new Exception ("no delegate in event");*/ return t; - } else - return null; + } + + return null; } } @@ -245,11 +246,11 @@ namespace System.Reflection { string frameName; if (method.IsStatic) { - typeVector = new Type[] { method.GetParameters () [0].ParameterType }; + typeVector = new Type[] { method.GetParametersInternal () [0].ParameterType }; addHandlerDelegateType = typeof (StaticAddEvent<>); frameName = "StaticAddEventAdapterFrame"; } else { - typeVector = new Type[] { method.DeclaringType, method.GetParameters () [0].ParameterType }; + typeVector = new Type[] { method.DeclaringType, method.GetParametersInternal () [0].ParameterType }; addHandlerDelegateType = typeof (AddEvent<,>); frameName = "AddEventFrame"; } diff --git a/mcs/class/corlib/System.Reflection/MethodBase.cs b/mcs/class/corlib/System.Reflection/MethodBase.cs index 7e538f451e7..671f11d0057 100644 --- a/mcs/class/corlib/System.Reflection/MethodBase.cs +++ b/mcs/class/corlib/System.Reflection/MethodBase.cs @@ -88,10 +88,8 @@ namespace System.Reflection { // This is a quick version for our own use. We should override // it where possible so that it does not allocate an array. // - internal virtual int GetParameterCount () - { - throw new NotImplementedException ("must be implemented"); - } + internal abstract ParameterInfo[] GetParametersInternal (); + internal abstract int GetParametersCount (); internal virtual Type GetParameterType (int pos) { throw new NotImplementedException (); diff --git a/mcs/class/corlib/System.Reflection/MonoMethod.cs b/mcs/class/corlib/System.Reflection/MonoMethod.cs index fe381b93a9d..8c07b1ec4ac 100644 --- a/mcs/class/corlib/System.Reflection/MonoMethod.cs +++ b/mcs/class/corlib/System.Reflection/MonoMethod.cs @@ -170,16 +170,24 @@ namespace System.Reflection { public override ParameterInfo[] GetParameters () { - ParameterInfo[] src = MonoMethodInfo.GetParametersInfo (mhandle, this); - ParameterInfo[] res = new ParameterInfo [src.Length]; - src.CopyTo (res, 0); - return res; + var src = MonoMethodInfo.GetParametersInfo (mhandle, this); + if (src.Length == 0) + return src; + + // Have to clone because GetParametersInfo icall returns cached value + var dest = new ParameterInfo [src.Length]; + Array.FastCopy (src, 0, dest, 0, src.Length); + return dest; + } + + internal override ParameterInfo[] GetParametersInternal () + { + return MonoMethodInfo.GetParametersInfo (mhandle, this); } - internal override int GetParameterCount () + internal override int GetParametersCount () { - var pi = MonoMethodInfo.GetParametersInfo (mhandle, this); - return pi == null ? 0 : pi.Length; + return MonoMethodInfo.GetParametersInfo (mhandle, this).Length; } /* @@ -197,7 +205,7 @@ namespace System.Reflection { binder = Binder.DefaultBinder; /*Avoid allocating an array every time*/ - ParameterInfo[] pinfo = MonoMethodInfo.GetParametersInfo (mhandle, this); + ParameterInfo[] pinfo = GetParametersInternal (); if (!binder.ConvertArgs (parameters, pinfo, culture, (invokeAttr & BindingFlags.ExactBinding) != 0)) throw new ArgumentException ("failed to convert parameters"); @@ -340,7 +348,7 @@ namespace System.Reflection { sb.Append ("]"); } sb.Append ("("); - ParameterInfo[] p = GetParameters (); + ParameterInfo[] p = GetParametersInternal (); for (int i = 0; i < p.Length; ++i) { if (i > 0) sb.Append (", "); @@ -476,7 +484,12 @@ namespace System.Reflection { return MonoMethodInfo.GetParametersInfo (mhandle, this); } - internal override int GetParameterCount () + internal override ParameterInfo[] GetParametersInternal () + { + return MonoMethodInfo.GetParametersInfo (mhandle, this); + } + + internal override int GetParametersCount () { var pi = MonoMethodInfo.GetParametersInfo (mhandle, this); return pi == null ? 0 : pi.Length; diff --git a/mcs/class/corlib/System.Reflection/MonoProperty.cs b/mcs/class/corlib/System.Reflection/MonoProperty.cs index f41512ca268..9760c197006 100644 --- a/mcs/class/corlib/System.Reflection/MonoProperty.cs +++ b/mcs/class/corlib/System.Reflection/MonoProperty.cs @@ -119,7 +119,7 @@ namespace System.Reflection { if (info.get_method != null) { return info.get_method.ReturnType; } else { - ParameterInfo[] parameters = info.set_method.GetParameters (); + ParameterInfo[] parameters = info.set_method.GetParametersInternal (); return parameters [parameters.Length - 1].ParameterType; } @@ -184,11 +184,11 @@ namespace System.Reflection { if (info.get_method != null) { res = info.get_method.GetParameters (); } else if (info.set_method != null) { - ParameterInfo[] src = info.set_method.GetParameters (); + ParameterInfo[] src = info.set_method.GetParametersInternal (); res = new ParameterInfo [src.Length - 1]; Array.Copy (src, res, res.Length); } else - return new ParameterInfo [0]; + return EmptyArray<ParameterInfo>.Value; for (int i = 0; i < res.Length; ++i) { ParameterInfo pinfo = res [i]; diff --git a/mcs/class/corlib/System.Reflection/ParameterInfo.cs b/mcs/class/corlib/System.Reflection/ParameterInfo.cs index eabb285ac3c..1a37b2635db 100644 --- a/mcs/class/corlib/System.Reflection/ParameterInfo.cs +++ b/mcs/class/corlib/System.Reflection/ParameterInfo.cs @@ -199,8 +199,8 @@ namespace System.Reflection MethodInfo mi = prop.GetGetMethod (true); if (mi == null) mi = prop.GetSetMethod (true); - /*TODO expose and use a GetParametersNoCopy()*/ - return mi.GetParameters () [PositionImpl].MetadataToken; + + return mi.GetParametersInternal () [PositionImpl].MetadataToken; } else if (MemberImpl is MethodBase) { return GetMetadataToken (); } diff --git a/mcs/class/corlib/System/Attribute.cs b/mcs/class/corlib/System/Attribute.cs index c82dd8406f4..48f5a0f5662 100644 --- a/mcs/class/corlib/System/Attribute.cs +++ b/mcs/class/corlib/System/Attribute.cs @@ -346,7 +346,7 @@ namespace System var method = ((MethodInfo) member).GetBaseMethod (); while (true) { - var param = method.GetParameters () [parameter.Position]; + var param = method.GetParametersInternal () [parameter.Position]; if (param.IsDefined (attributeType, false)) return true; @@ -377,7 +377,7 @@ namespace System var custom_attributes = new List<Attribute> (); while (true) { - var param = method.GetParameters () [parameter.Position]; + var param = method.GetParametersInternal () [parameter.Position]; var param_attributes = (Attribute []) param.GetCustomAttributes (attributeType, false); foreach (var param_attribute in param_attributes) { var param_type = param_attribute.GetType (); diff --git a/mcs/class/corlib/System/Delegate.cs b/mcs/class/corlib/System/Delegate.cs index 4a936201b0b..7610e43dcba 100644 --- a/mcs/class/corlib/System/Delegate.cs +++ b/mcs/class/corlib/System/Delegate.cs @@ -191,8 +191,8 @@ namespace System else return null; - ParameterInfo[] delargs = invoke.GetParameters (); - ParameterInfo[] args = method.GetParameters (); + ParameterInfo[] delargs = invoke.GetParametersInternal (); + ParameterInfo[] args = method.GetParametersInternal (); bool argLengthMatch; @@ -311,7 +311,7 @@ namespace System throw new ArgumentException ("type is not subclass of MulticastDelegate."); MethodInfo invoke = type.GetMethod ("Invoke"); - ParameterInfo [] delargs = invoke.GetParameters (); + ParameterInfo [] delargs = invoke.GetParametersInternal (); Type[] delargtypes = new Type [delargs.Length]; for (int i=0; i<delargs.Length; i++) @@ -408,7 +408,7 @@ namespace System method_info = m_target.GetType ().GetMethod (data.method_name, mtypes); } - if (Method.IsStatic && (args != null ? args.Length : 0) == Method.GetParameters ().Length - 1) { + if (Method.IsStatic && (args != null ? args.Length : 0) == Method.GetParametersCount () - 1) { // The delegate is bound to m_target if (args != null) { object[] newArgs = new object [args.Length + 1]; diff --git a/mcs/class/corlib/System/Exception.cs b/mcs/class/corlib/System/Exception.cs index 3fe55050099..0a9ef607c75 100644 --- a/mcs/class/corlib/System/Exception.cs +++ b/mcs/class/corlib/System/Exception.cs @@ -346,7 +346,7 @@ namespace System internal void GetFullNameForStackTrace (StringBuilder sb, MethodBase mi) { - ParameterInfo[] p = mi.GetParameters (); + ParameterInfo[] p = mi.GetParametersInternal (); sb.Append (mi.DeclaringType.ToString ()); sb.Append ("."); sb.Append (mi.Name); diff --git a/mcs/class/corlib/System/MonoType.cs b/mcs/class/corlib/System/MonoType.cs index ab4829a3083..985fb497329 100644 --- a/mcs/class/corlib/System/MonoType.cs +++ b/mcs/class/corlib/System/MonoType.cs @@ -426,7 +426,7 @@ namespace System else throwMissingMethodDescription = "Cannot find method " + name + "."; } else { - ParameterInfo[] parameters = m.GetParameters(); + ParameterInfo[] parameters = m.GetParametersInternal(); for (int i = 0; i < parameters.Length; ++i) { if (System.Reflection.Missing.Value == args [i] && (parameters [i].Attributes & ParameterAttributes.HasDefault) != ParameterAttributes.HasDefault) throw new ArgumentException ("Used Missing.Value for argument without default value", "parameters"); |