Author: lupus
Date: 2006-02-20 05:20:48 -0500 (Mon, 20 Feb 2006)
New Revision: 57061

Modified:
   trunk/mcs/class/corlib/System/ChangeLog
   trunk/mcs/class/corlib/System/MonoType.cs
Log:


Mon Feb 20 11:19:54 CET 2006 Paolo Molaro <[EMAIL PROTECTED]>

        * MonoType.cs: patch from Joachim Ante <[EMAIL PROTECTED]> to
        improve error messages.



Modified: trunk/mcs/class/corlib/System/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System/ChangeLog     2006-02-20 09:38:29 UTC (rev 
57060)
+++ trunk/mcs/class/corlib/System/ChangeLog     2006-02-20 10:20:48 UTC (rev 
57061)
@@ -1,3 +1,9 @@
+
+Mon Feb 20 11:19:54 CET 2006 Paolo Molaro <[EMAIL PROTECTED]>
+
+       * MonoType.cs: patch from Joachim Ante <[EMAIL PROTECTED]> to
+       improve error messages.
+
 2006-02-15  Martin Baulig  <[EMAIL PROTECTED]>
 
        * Type.cs (Type.IsGenericInstance): Removed.

Modified: trunk/mcs/class/corlib/System/MonoType.cs
===================================================================
--- trunk/mcs/class/corlib/System/MonoType.cs   2006-02-20 09:38:29 UTC (rev 
57060)
+++ trunk/mcs/class/corlib/System/MonoType.cs   2006-02-20 10:20:48 UTC (rev 
57061)
@@ -362,14 +362,18 @@
                                name = attr.MemberName;
                        }
                        bool ignoreCase = (invokeAttr & 
BindingFlags.IgnoreCase) != 0;
-                       bool throwMissingMethodException = false;
+                       string throwMissingMethodDescription = null;
                        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) {
-                                       throwMissingMethodException = true;
+                                       if (methods.Length > 0)
+                                               throwMissingMethodDescription = 
"The best match for method " + name + " has some invalid parameter.";
+                                       else
+                                               throwMissingMethodDescription = 
"Cannot find method " + name + ".";
                                } else {
                                        object result = m.Invoke (target, 
invokeAttr, binder, args, culture);
                                        binder.ReorderArgumentArray (ref args, 
state);
@@ -441,10 +445,10 @@
                                        return result;
                                }
                        }
-                       if (throwMissingMethodException)
-                               throw new MissingMethodException();
+                       if (throwMissingMethodDescription != null)
+                               throw new 
MissingMethodException(throwMissingMethodDescription);
                        if (throwMissingFieldException)
-                               throw new MissingFieldException();
+                               throw new MissingFieldException("Cannot find 
variable " + name + ".");
 
                        return null;
                }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to