Release notes for re-motion version 1.13.128

List of Issues

New Features

Details

[RM-4465] Avoid InvalidOperationExceptions in PartialEvaluatingExpressionTreeVisitor with .NET 4's DynamicExpression

Component/s: Data.Linq
Issue Type: New Feature
Resolution: Fixed
Status: Closed


Currently, re-linq assumes that ExpressionTreeVisitor can handle all expressions defined by the ExpressionType enum. This is true in .NET 3.5, but not in .NET 4, where new expression types were added which aren't yet supported by ExpressionTreeVisitor. EvaluatableTreeFindingExpressionTreeVisitor (used by partial evaluation) depends on this assumption.

When using .NET 3.5 re-linq on a .NET 4 expression tree, this can lead to EvaluatableTreeFindingExpressionTreeVisitor incorrectly marking DynamicExpressions referencing outer parameters as partially evaluable. This causes InvalidOperationExceptions with the message "System.InvalidOperationException : variable '...' of type 'System.Object' referenced from scope '', but it is not defined".

Until re-linq switches to .NET 4, make this more robust by more explicitly testing whether expressions are actually supported by ExpressionTreeVisitor.
(Note that expressions holding DynamicExpression nodes will always be marked "non-evaluable" after that change.)