Skip to content

ConditionalAnd with variables #56

Closed
@HelgeL

Description

@HelgeL

First, I want to say it's a fascinating and high-quality module, congratulations and thank you for putting it up here!

I have a problem evaluating expressions with variables when using ConditionalAnd and null values:

Dictionary<string, object> dictValues = new Dictionary<string, object>();
string nullString = null;
dictValues[ "TestNullString" ] = nullString;

//pass dictValues as expEval.Variables into expression evaluation instance and then...
string expression = "!string.IsNullOrEmpty(TestNullString) && TestNullString.StartsWith(\"ABC\")";
var result = expEval.Evaluate(expression);

This throws a NullReferenceException with the second half, where "plain C#" would skip evaluating this part. The issue seems related to some that were discussed here recently, especially #51 and #53, but the fixes don't address it. The exception details are:

 at ExpressionEvaluator.DetermineInstanceOrStatic(Type& objType, Object& obj, ValueTypeNestingTrace& valueTypeNestingTrace) in EvaluatorTest\ExpressionEvaluator.cs

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions