diff options
Diffstat (limited to 'mcs/class/corlib/System/MonoType.cs')
-rw-r--r-- | mcs/class/corlib/System/MonoType.cs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/mcs/class/corlib/System/MonoType.cs b/mcs/class/corlib/System/MonoType.cs index f79ab1ba418..d1fec3eb774 100644 --- a/mcs/class/corlib/System/MonoType.cs +++ b/mcs/class/corlib/System/MonoType.cs @@ -362,18 +362,14 @@ namespace System name = attr.MemberName; } bool ignoreCase = (invokeAttr & BindingFlags.IgnoreCase) != 0; - string throwMissingMethodDescription = null; + bool throwMissingMethodException = false; bool throwMissingFieldException = false; - if ((invokeAttr & BindingFlags.InvokeMethod) != 0) { MethodInfo[] methods = GetMethodsByName (name, invokeAttr, ignoreCase, this); object state = null; MethodBase m = binder.BindToMethod (invokeAttr, methods, ref args, modifiers, culture, namedParameters, out state); if (m == null) { - if (methods.Length > 0) - throwMissingMethodDescription = "The best match for method " + name + " has some invalid parameter."; - else - throwMissingMethodDescription = "Cannot find method " + name + "."; + throwMissingMethodException = true; } else { object result = m.Invoke (target, invokeAttr, binder, args, culture); binder.ReorderArgumentArray (ref args, state); @@ -445,10 +441,10 @@ namespace System return result; } } - if (throwMissingMethodDescription != null) - throw new MissingMethodException(throwMissingMethodDescription); + if (throwMissingMethodException) + throw new MissingMethodException(); if (throwMissingFieldException) - throw new MissingFieldException("Cannot find variable " + name + "."); + throw new MissingFieldException(); return null; } |