-
Type: Bug
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Dotnet Drivers
Issue:
When trying to use .Select() where the lambda body is a new Dictionary<string,object>, the following error is observed:
System.InvalidOperationException When called from 'VisitListInit', rewriting a node of type 'System.Linq.Expressions.NewExpression' must return a non-null value of the same type. Alternatively, override 'VisitListInit' and change it to not visit children of this type.
The original Visit() call occurs in PartialEvaluator.cs.
Repro:
[Fact] public void Select_Dict_obj_should_work() { var collection = GetCollection(LinqProvider.V3); var queryable = collection.AsQueryable() .Select(x => new Dictionary<string, object> { { "a", x } }); var stages = Translate(collection, queryable); var dt = queryable.ToList(); } private class C { public int A { get; set; } }
- is related to
-
CSHARP-5190 Support Select new BsonDocument
- Closed