playMaker

Author Topic: CallMethod "parameters don't match method signature" error  (Read 2880 times)

OrangeeZ

  • Playmaker Newbie
  • *
  • Posts: 2
Hi!

Another issue I've spotted recently is related to PlayMaker CallMethod not checking type relations during error check.

Let's imagine the following:
1. Method void TestMethod( BaseType item );
2. Object of derived type DerivedType
3. An attempt to call TestMethod with DerivedType object as an argument.

The resulting "parameters don't match method signature" error comes from the fact that two types are checked for equality, but not for relation. BaseType != DerivedType, but DerivedType => BaseType.

Thus, changing the Line 152:
if (!ReferenceEquals(paramType, paramInfoType ) to
if (!ReferenceEquals(paramType, paramInfoType ) && !paramType.IsSubclassOf(paramInfoType))
solves the issue.

But there comes another thought: since GetMethod when picking suitable method does take type relations into account while matching argument types, manual type checking in DoError doesn't make sense - it's simply better to re-cache method every time, due to the fact that one changed variable can lead to much different method overload, and much different method being picked as a result.

Hopefully this makes sense and will help!