From a72e01ed745a8cd278f44ecb375d593e6aabc88a Mon Sep 17 00:00:00 2001 From: AlexCatarino Date: Fri, 13 Jul 2018 17:04:26 +0100 Subject: [PATCH] Adds method name to "no method matches" error --- AUTHORS.md | 1 + CHANGELOG.md | 1 + src/runtime/methodbinder.cs | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AUTHORS.md b/AUTHORS.md index 55911cd0b..e37ec6436 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -12,6 +12,7 @@ ## Contributors +- Alexandre Catarino([@AlexCatarino](https://github.com/AlexCatarino)) - Arvid JB ([@ArvidJB](https://github.com/ArvidJB)) - Bradley Friedman ([@leith-bartrich](https://github.com/leith-bartrich)) - Callum Noble ([@callumnoble](https://github.com/callumnoble)) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea549e9f8..a19f4a10c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][]. - Fixed `Python.Runtime.dll.config` on macOS ([#120][i120]) - Fixed crash on `PythonEngine.Version` ([#413][i413]) - Fixed `PythonEngine.PythonPath` issues ([#179][i179])([#414][i414])([#415][p415]) +- Fixed missing information on 'No method matches given arguments' by adding the method name ### Removed diff --git a/src/runtime/methodbinder.cs b/src/runtime/methodbinder.cs index f0c58f34f..eeec8b89d 100644 --- a/src/runtime/methodbinder.cs +++ b/src/runtime/methodbinder.cs @@ -507,7 +507,12 @@ internal virtual IntPtr Invoke(IntPtr inst, IntPtr args, IntPtr kw, MethodBase i if (binding == null) { - Exceptions.SetError(Exceptions.TypeError, "No method matches given arguments"); + var value = "No method matches given arguments"; + if (methodinfo != null && methodinfo.Length > 0) + { + value += $" for {methodinfo[0].Name}"; + } + Exceptions.SetError(Exceptions.TypeError, value); return IntPtr.Zero; }