mparlak / Flee

Fast Lightweight Expression Evaluator
607 stars 119 forks source link

Cannot add variable with null value #104

Open MHDSAEEDRABID opened 1 year ago

MHDSAEEDRABID commented 1 year ago

I want to try to evaluate this simple expression . in this code I've added variable to VariableCollection variable name : "startDate" . variable value : null note : the type of Variable Collection (Dictionary) value is object

the issue : I got this exception System.ArgumentNullException: 'Value cannot be null. (Parameter 'value')'

ExpressionContext context = new ExpressionContext();
string expression = @"(startDate > ""2020-05-01""))";

var varaibles = context.Variables;
//Add variable with name startDate with null value
varaibles.Add("startDate",null);

var compile = context.CompileGeneric<bool>(expression);
var result = compile.Evaluate();