As discussed in https://github.com/pitermarx/NCalc-Edge/issues/14, when using circular references, the Evaluate method leads to a StackOverflowException (which is not catchable).
For user written expressions, this is a blocking problem.
For example :
NCalc.Expression exp = new NCalc.Expression("RefCroise1");
exp.Parameters["RefCroise1"] = new NCalc.Expression("RefCroise2 5");
exp.Parameters["RefCroise2"] = new NCalc.Expression("RefCroise1 12");
object result = exp.Evaluate(); // Causes stack overflow
.hasErrors() neither detects it.
I think this is a major error to be detected, as this is crashing the program.
Nota : I did not check how it is in NCalc2 but as @pitermarx asked, I'm creating the PR here.
Thanks.
As discussed in https://github.com/pitermarx/NCalc-Edge/issues/14, when using circular references, the Evaluate method leads to a StackOverflowException (which is not catchable). For user written expressions, this is a blocking problem. For example :
NCalc.Expression exp = new NCalc.Expression("RefCroise1"); exp.Parameters["RefCroise1"] = new NCalc.Expression("RefCroise2 5"); exp.Parameters["RefCroise2"] = new NCalc.Expression("RefCroise1 12"); object result = exp.Evaluate(); // Causes stack overflow
.hasErrors() neither detects it.
I think this is a major error to be detected, as this is crashing the program.
Nota : I did not check how it is in NCalc2 but as @pitermarx asked, I'm creating the PR here. Thanks.