We're updating the issue view to help you get more done. 

Relinq breaks on parsing null values

Description

PartialEvaluatingExpressionTreeVisitor breaks while compiling lambda expression which has nested member access and upper member is null.

for example : Property.NestedProperty.Value == something

if Property == null (or NestedProperty == null) EvaluateSubtree will explode.

Here is a fix which works for me:

I've added a check for nested member evaluation and returned constant null if member is null.
While this is not entirely correct, since this part of lambda expression has purged evaluation shortcutting and this is consistent with sql behavior, I think this is accepted behavior.

You can improve this patch by recursively evaluating member expressions to see if some other property is not null.
For example if you have
Property.FirstNestedProperty.SecondNestedProperty.ThirdNestedProperty.Value

Regards,
Rikard

Status

Assignee

Fabian Schmied

Reporter

User

Labels

None

Components

Fix versions

Affects versions

1.13.135

Priority

Normal
Configure