zzzprojects / Eval-Expression.NET

C# Eval Expression | Evaluate, Compile, and Execute C# code and expression at runtime.
https://eval-expression.net/
Other
459 stars 86 forks source link

System.StackOverflowException #49

Closed tiptopdevelopment closed 5 years ago

tiptopdevelopment commented 5 years ago

First of all, awesome library!!

I'm getting StackOverflow at i = 212;

string expression = "a * 5 - b / 2";
            for (int i = 0; i < 1000; i++)
            {
                expression = expression + " + a - b";

                decimal xxx = expression.Execute<decimal>(new
                {
                    a = 2,
                    b = 4
                });
            }
JonathanMagnan commented 5 years ago

Hello @tiptopdevelopment ,

Thank you for reporting, we have confirmed this issue.

We believe the issue is due because of Stack become too big.

Fixing it may require a lot of work due that is not something that we have expected to happen when we created the library, so the question it's more if you really need it fixed or not?

This issue will not likely happen with a real expression but if you need it fixed, we will be happy to look at it to check if there is something we can do.

Best Regards,

Jonathan