Hello Davide and everyone.
Consider this function
public static class ParamArrayTester
{
public static int ParamArrayObjects(params object[] values)
{
return values.Length;
}
}
If I implement the following test:
[Test]
public void Test_ParamArrayObjects()
{
Interpreter dexp = new Interpreter();
dexp.Reference(typeof(ParamArrayTester));
string expText = "ParamArrayTester.ParamArrayObjects(null, null, 0, 0)";
Object resultObject = dexp.Eval(expText);
Assert.AreEqual(4, (int)resultObject);
}
Exception :
System.ArgumentException: 'Incorrect number of arguments supplied for call to method 'Int32 ParamArrayObjects(System.Object[])' (Parameter 'method')'
On Stack:
ParseNormalMethodInvocation
return Expression.Call(instance, (MethodInfo)method.MethodBase, method.PromotedParameters);
The following call works perfectly :
string expText = "ParamArrayTester.ParamArrayObjects(0, null, null, null)";
So the guess is that the first parameter makes the difference somehow.
Thanks in advance, cheers.
Hello Davide and everyone.
Consider this function
If I implement the following test:
Exception :
On Stack:
The following call works perfectly :
So the guess is that the first parameter makes the difference somehow.
Thanks in advance, cheers.