You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 1.4.20 I started having an issue with member methods not being found, specifically on DateTime and DateTimeOffset. Some digging and it looks like the parameter filter are causing some of the basic methods like AddDays(double d) to be excluded when the given parameter is in fact an int.
var evaluator = new ExpressionEvaluator();
evaluator.Evaluate("DateTime.Now.AddDays(1)");
This will yield an exception, CodingSeb.ExpressionEvaluator.ExpressionEvaluatorSyntaxErrorException: [System.DateTime] object has no Method named "AddDays".]
Specifying the variable as a double fixes the issue, evaluator.Evaluate("DateTime.Now.AddDays(1d)"); but this isn't always ideal or obvious as int is implicitly convertable to double and passing an int to AddDays is valid C#.
I see in the commits that this section of code is being worked on - is this something I should try to fix and send in a pull request? Or hold off till next release, or let the maintainers handle?
The text was updated successfully, but these errors were encountered:
Hello @leniency.
Thanks for reporting this bug.
Yes the last version introduced some new features (see #83) that required to rewrite some part of the code that search for the good method to call.
I did some tests but I missed these kind of cases. I am sorry about that. I think I know what is wrong. I will correct it as soon as possible and add some tests to cover these cases.
It is possible that others bugs that I missed appears due to last version code rewriting. If so thanks to report it.
I published version 1.4.21.0 that correct this bug.
I created some tests to check theses cases.
So it ensure that this specific bug should not come again.
In 1.4.20 I started having an issue with member methods not being found, specifically on DateTime and DateTimeOffset. Some digging and it looks like the parameter filter are causing some of the basic methods like
AddDays(double d)
to be excluded when the given parameter is in fact an int.This will yield an exception,
CodingSeb.ExpressionEvaluator.ExpressionEvaluatorSyntaxErrorException: [System.DateTime] object has no Method named "AddDays".]
Specifying the variable as a double fixes the issue,
evaluator.Evaluate("DateTime.Now.AddDays(1d)");
but this isn't always ideal or obvious as int is implicitly convertable to double and passing an int toAddDays
is valid C#.I see in the commits that this section of code is being worked on - is this something I should try to fix and send in a pull request? Or hold off till next release, or let the maintainers handle?
The text was updated successfully, but these errors were encountered: