-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix to #17236 - Improve readability of expressions in client evaluation exception #18228
Conversation
ping |
@AndriySvyryd @smitpatel new version up |
[ConditionalFact] | ||
public void BinaryExpression_printed_correctly() | ||
{ | ||
Assert.Equal("7 == 42", _expressionPrinter.Print(Expression.MakeBinary(ExpressionType.Equal, Expression.Constant(7), Expression.Constant(42)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be.
new ExpressionPrinter().Print(((Expression<Func<int, bool>>)(e => e > 42)).Body)
350facc
to
2ffc3f4
Compare
Visit(methodArguments[0]); | ||
|
||
var methodDeclaringType = methodCallExpression.Method.DeclaringType; | ||
if (methodDeclaringType == typeof(Queryable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought checking for extension method was sufficient to remove this specific type checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this increments the indent but check below to decrement the indent check only for simplified method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this special cases Enumerable/Queryable to be printed as:
souce
.Method(arguments)
rather than single line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add regression test too
expressionPrinter.Append($"MaterializeCollectionNavigation({Navigation}, "); | ||
expressionPrinter.Visit(Subquery); | ||
expressionPrinter.Append(")"); | ||
expressionPrinter.AppendLine("MaterializeCollectionNavigation("); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove (
after the expression type. Use nameof syntax.
…on exception Adding a new switch to ExpressionPrinter that creates simplified output for Print and verbose (i.e. what we had before this change) for PrintDebug. Simplified output means: - displaying extension methods as extension methods rather than regular static methods, - simplifying display of Navigation object, - not showing if lambda body references parameter that is out of scope. Also fixed minor display bugs in expression printer. Also some changes in testing: - added unit tests for ExpressionPrinter, - DRY the "translation failed" tests, - "translation failed" tests no longer verify expression in the exception message and instead just make sure that right exception is thrown.
Adding a new switch to ExpressionPrinter that creates simplified output for Print and verbose (i.e. what we had before this change) for PrintDebug.
Simplified output means:
Also fixed minor display bugs in expression printer.
Also some changes in testing:
Resolves #17236