Release notes for re-motion version 1.13.47

List of Issues

Bugfixes

Breaking Changes

New Features

Details

[COMMONS-2291] ExpressionTreeVisitor.VisitNewArrayExpression throws an exception when the element initialization expressions change

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


In VisitNewArrayExpression, expression.Type.ElementType should be used instead of expression.Type.

[COMMONS-1910] Remotion.Data.Linq.Backend.DetailParsing.ParserRegistry.GetParsers(Type expressionType) must be refactored to take changes in .NET 4 Expression|s into account

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


In Remotion.Data.Linq.Backend.DetailParsing.ParserRegistry GetParsers(Type expressionType) must be refactored to take into account that
1) There exist new, Expression sub-types (e.g. MethodBinaryExpression)
2) The order of the parsers is no longer irrelevant

The following quick code fixes 1) to make tests green, BUT DOES NOT FIX 2) !

public IEnumerable<IParser> GetParsers(Type expressionType)
{
//return _parsers[expressionType];
foreach (var parser in _parsers)
{
if (parser.Key.IsAssignableFrom(expressionType))

{ return parser.Value; }

}

throw new ParserException(string.Format("No parser to parse expression of type {0} found.",expressionType));
}

[COMMONS-2308] ExpressionTreeVisitor.VisitExpression is now public

Component/s: Data.Linq
Issue Type: Breaking Change
Resolution: Fixed
Status: Closed


This change was made to improve .NET 4.0 compatibility and to enable double-dispatch visitor scenarios.

[COMMONS-2303] Extension expression support similar to .NET 4.0

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


This feature provides a new ExtensionExpression class which is meant to be the base class for custom expression types:

class ExtensionExpression : Expression
{
  ...

  public bool CanReduce { get; }
  public Expression Reduce();
  public Expression ReduceAndCheck();

  public void Accept (ExpressionTreeVisitor visitor);
  public void VisitChildren (ExpressionTreeVisitor visitor);
}

The methods are equivalent to the new methods on .NET 4.0's expression type.

ExpressionTreeVisitor.VisitExpression is changed to first check the expression for assignability to ExtensionExpression. If assignment is possible, it calls ExtensionExpression.Accept, which can be implemented by custom expressions to dispatch to the right Visit method. E.g, SubQueryExpression would use this method to dispatch to VisitSubQueryExpression. The custom expression can also test for a specific visitor interface (e.g., ISubQueryExpressionVisitor). If no dedicated Visit method exists, the method dispatches to ExpressionTreeVisitor.VisitUnknownExpression.

ExpressionTreeVisitor.VisitUnknownExpression is changed to call VisitChildren on the expression if the expression is an ExtensionExpression. If it is not, it throws a NotSupportedException (as it does now).

As a separate feature, ThrowingExpressionTreeVisitor will get a new mode called "automatic reduce mode". In this mode, VisitUnknownExpression tests whether the expression can be reduced. If so, it reduces the expression and visits the result. An exception is only thrown when the expression is not reducible (or when the reduced expression cannot be handled). "Exact" mode corresponds to the current behavior - an exception is thrown (without an attempt for reduction) by default.