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
We use the this framework to evaluate user-created formulas where values are replaced at runtime. I offer that explanation only to justify the hideous C# I'm about to post.
The user-created expression/formula below is not able to be evaluated by the Eval-Expression framework:
Operator '-' cannot be applied to operands of type 'RuntimeType' and 'int'. The error occurred for expression "-" at position 22 near "-2 / 2) - (decimal)0.0625".
This same expression is evaluated successfully in dotnetfiddle.net.
Removing the '-' from the (decimal)-2 allows the evaluation framework to work.
UPDATE/EDIT:
I'd like to add that after further testing, the bug can be more easily reproduced: (decimal)-2.
The text was updated successfully, but these errors were encountered:
We don't feel the fix is perfect yet, so we will discuss how we can further improve it. So far, we have found that is still possible to get some issues when using a variable or navigation path (instead of a type to cast) in parenthesis before the subtract sign.
We use the this framework to evaluate user-created formulas where values are replaced at runtime. I offer that explanation only to justify the hideous C# I'm about to post.
The user-created expression/formula below is not able to be evaluated by the Eval-Expression framework:
Math.Round((((decimal)-2 / 2) - (decimal)0.0625 - ((decimal)2 / 2)) * 32) / 32
The error is:
This same expression is evaluated successfully in dotnetfiddle.net.
Removing the '-' from the
(decimal)-2
allows the evaluation framework to work.UPDATE/EDIT:
I'd like to add that after further testing, the bug can be more easily reproduced:
(decimal)-2
.The text was updated successfully, but these errors were encountered: