-
Notifications
You must be signed in to change notification settings - Fork 104
Closed
Labels
Description
Something is broken handling nulls and inexistent variables
if Name has a valid string, everything is ok, but if Name is null an exception should be triggered but it doesn't
and if instead of Name you call some other property (inexistent) an exception should be triggered too but it doesn't
the problem happens when the expression is compossed with some elements
Eval.Context = new { Person = new Person { Name = null, Value = 1.11m } };
try
{
var result2 = Eval.Evaluate("\"test one \" + Person.Name.Trim()");
var result3 = Eval.Evaluate("\"test two\" + Person.AnotherName.Trim()");
}
catch(Exception e)
{
// no exception is triggered
Console.WriteLine(e.Message);
}
//****************************************************
public class Person
{
public string Name { get; set; }
public decimal? Value { get; set; }
}