[CSHARP-4957] IMongoCollection.AsQueryable().Select() fails for array type (regression) Created: 06/Feb/24 Updated: 07/Feb/24 |
|
| Status: | Investigating |
| Project: | C# Driver |
| Component/s: | LINQ3 |
| Affects Version/s: | 2.19.0, 2.23.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Evgeny Morozov | Assignee: | Robert Stam |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Dotnet Drivers
|
| Description |
| Comments |
| Comment by Robert Stam [ 07/Feb/24 ] | |||
|
Now that I have the parenthesis in the same place that you do I also get the same exception that you got. I will investigate further. Thanks for noticing that my test was different than your code. | |||
| Comment by Robert Stam [ 07/Feb/24 ] | |||
|
Sorry I read your code wrong. I will change the test and see if I get the same error you do. | |||
| Comment by Evgeny Morozov [ 07/Feb/24 ] | |||
|
Also,
is not the same as my code. The brackets are placed differently, giving it a different meaning. | |||
| Comment by Evgeny Morozov [ 07/Feb/24 ] | |||
|
Hi Robert, have you tested it on either of the two versions in "Affects Version/s"? | |||
| Comment by Robert Stam [ 06/Feb/24 ] | |||
|
I am unable to reproduce this. I used the following test statement:
When using LINQ2 this throws a `NotSupportedException`. When using LINQ3 this translates to the following aggregation pipeline:
I tested against the latest version of the driver source code on the master branch. Let me know if this is only failing in a particular version of the driver. Calling ToArray on something that is already an array is redundant, but it is legal and should work. | |||
| Comment by Evgeny Morozov [ 06/Feb/24 ] | |||
|
Sorry, the code in "Summary" is with the workaround, and it seems that I cannot edit it. The code that fails is var thisFails = collection.AsQueryable().Select(t => new[] { t.Integer }).ToArray(); | |||
| Comment by PM Bot [ 06/Feb/24 ] | |||
|
Hi evgeny+mongodb@loop54.com, thank you for reporting this issue! The team will look into it and get back to you soon. |