Skip to content

Commit 6379568

Browse files
committed
Fix TestNoOverloadException unit test
1 parent 108eacf commit 6379568

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/runtime/methodbinder.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,12 +731,19 @@ internal virtual IntPtr Invoke(IntPtr inst, IntPtr args, IntPtr kw, MethodBase i
731731

732732
if (binding == null)
733733
{
734-
var value = "No method matches given arguments";
734+
var value = new StringBuilder("No method matches given arguments");
735735
if (methodinfo != null && methodinfo.Length > 0)
736736
{
737-
value += $" for {methodinfo[0].Name}";
737+
value.Append($" for {methodinfo[0].Name}");
738738
}
739-
Exceptions.SetError(Exceptions.TypeError, value);
739+
else if (list.Count > 0)
740+
{
741+
value.Append($" for {list[0].MethodBase.Name}");
742+
}
743+
744+
value.Append(": ");
745+
AppendArgumentTypes(to: value, args);
746+
Exceptions.RaiseTypeError(value.ToString());
740747
return IntPtr.Zero;
741748
}
742749

0 commit comments

Comments
 (0)