zzzprojects / Eval-Expression.NET

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

Not able to parse if(true) #30

Closed ashokrayal closed 6 years ago

JonathanMagnan commented 6 years ago

Hello @Ashokrayal ,

Could you provide an example? We have a few unit test with this expression which seems to work.

For example:

var x = Eval.Execute("if(true) return 1; return 2;");

Best Regards,

Jonathan

ashokrayal commented 6 years ago

It is failing at the time of scope compile.

string expression = "if(true){}"; var p = new CompiledExpression(expression) { TypeRegistry = new TypeRegistry() }; return p.ScopeCompile<Scope>();

object reference null reference is occurring at the last line.

JonathanMagnan commented 6 years ago

Hello @Ashokrayal ,

You are currently using the ExpressionEvaluator library which has multiple issues and obsolete (no longer supported).

If that's possible, I recommand you to move to http://eval-expression.net/ (paid library). That's the library we support and which work with your expression.

Best Regards,

Jonathan