-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.6.1
-
Component/s: None
-
None
We are being too aggressive when normalizing an expression tree. Stack trace below. I think the issue is here: https://github.com/mongodb/mongo-csharp-driver/blob/master/Driver/Linq/Expressions/ExpressionNormalizer.cs#L148
at System.Linq.Expressions.Expression.GetEqualityComparisonOperator(ExpressionType binaryType, String opName, Expression left, Expression right, Boolean liftToNull)
at System.Linq.Expressions.Expression.Equal(Expression left, Expression right, Boolean liftToNull, MethodInfo method)
at System.Linq.Expressions.Expression.MakeBinary(ExpressionType binaryType, Expression left, Expression right, Boolean liftToNull, MethodInfo method, LambdaExpression conversion)
at System.Linq.Expressions.Expression.MakeBinary(ExpressionType binaryType, Expression left, Expression right, Boolean liftToNull, MethodInfo method)
at MongoDB.Driver.Linq.ExpressionVisitor.VisitBinary(BinaryExpression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 165
at MongoDB.Driver.Linq.ExpressionNormalizer.VisitBinary(BinaryExpression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionNormalizer.cs:line 133
at MongoDB.Driver.Linq.ExpressionVisitor.Visit(Expression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 84
at MongoDB.Driver.Linq.ExpressionVisitor.VisitBinary(BinaryExpression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 154
at MongoDB.Driver.Linq.ExpressionNormalizer.VisitBinary(BinaryExpression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionNormalizer.cs:line 133
at MongoDB.Driver.Linq.ExpressionVisitor.Visit(Expression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 84
at MongoDB.Driver.Linq.ExpressionVisitor.VisitLambda(LambdaExpression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 275
at MongoDB.Driver.Linq.ExpressionVisitor.Visit(Expression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 98
at MongoDB.Driver.Linq.ExpressionVisitor.VisitUnary(UnaryExpression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 522
at MongoDB.Driver.Linq.ExpressionNormalizer.VisitUnary(UnaryExpression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionNormalizer.cs:line 143
at MongoDB.Driver.Linq.ExpressionVisitor.Visit(Expression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 60
at MongoDB.Driver.Linq.ExpressionVisitor.Visit(ReadOnlyCollection`1 nodes) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 125
at MongoDB.Driver.Linq.ExpressionVisitor.VisitMethodCall(MethodCallExpression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 438
at MongoDB.Driver.Linq.ExpressionVisitor.Visit(Expression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionVisitor.cs:line 96
at MongoDB.Driver.Linq.ExpressionNormalizer.Normalize(Expression node) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Expressions\ExpressionNormalizer.cs:line 51
at MongoDB.Driver.Linq.MongoQueryTranslator.Translate(MongoQueryProvider provider, Expression expression) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\Translators\MongoQueryTranslator.cs:line 49
at MongoDB.Driver.Linq.MongoQueryProvider.Execute(Expression expression) in C:\work\rstam\mongo-csharp-driver\Driver\Linq\MongoQueryProvider.cs:line 154
at MongoDB.Driver.Linq.MongoQueryable`1.GetEnumerator() in C:\work\rstam\mongo-csharp-driver\Driver\Linq\MongoQueryable.cs:line 81
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Newtonsoft.Json.Serialization.JsonArrayContract.CreateWrapper(Object list)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value)
at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value)
at System.Net.Http.Formatting.JsonMediaTypeFormatter.<>c_DisplayClassd.<WriteToStreamAsync>b_c()
at System.Threading.Tasks.TaskHelpers.RunSynchronously(Action action, CancellationToken token)
- is related to
-
CSHARP-632 Linq OrderBy throws when Expression type is object and property type is a value type
- Closed