Expression.GreaterThan fails if one operand is nullable type, other is non-nullable
The problem here is that the expression library is throwing an exception when given two arguments of mismatched nullability. Here’s a simple repro: Expression<Func<DateTime?>> ex1 = ()=>DateTime.Now; Expression<Func<DateTime>> ex2 = ()=>DateTime.Now; var ex3 = Expression.GreaterThan(ex1.Body, ex2.Body); It is not clear to me whether this is a bug or not; the rules of C# require that … Read more