[CSHARP-4054] One-to-many LINQ query using Join fails with InvalidOperationException Created: 11/Feb/22 Updated: 21/Apr/23 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | LINQ3 |
| Affects Version/s: | 2.14.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | James Kovacs | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | triage | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Documentation Changes: | Not Needed | ||||||||
| Documentation Changes Summary: | 1. What would you like to communicate to the user about this feature? |
||||||||
| Description |
|
If you try to reformulate the query in CSHARP-4053 using a join to the person.MovieIds enumerable, an InvalidOperationException is thrown:
The exception is:
|
| Comments |
| Comment by Alistair Steele [ 13/Mar/23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The following shows the issue, looks to happen when using a SelectMany with a resultSelector.
Results in the output:
Applying the same fix you did for .Join fixes the issue in GroupJoin (tried locally) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Robert Stam [ 13/Mar/23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for the additional information. Do you have any sample code I could use to reproduce this? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alistair Steele [ 10/Mar/23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'm getting a very similar stack trace (throwing InvalidOperationException in WrappedValueSerializer) with GroupJoin, after looking at the fix made it seems that fix may need to be applied to GroupJoin as well? @rstam | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 22/Feb/23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: CSHARP-4054: One-to-many LINQ query using Join fails with InvalidOperationException. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Robert Stam [ 15/Feb/23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for bringing this to our attention. I will look into it. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Matt Allwood [ 15/Feb/23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Still an issue with 2.19, which is an issue now that v3 is the default implementation used. Still working with v2 LINQ driver Similar stack trace to above, triggered by WrappedValueSerializer:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Joris Laperre [ 26/Feb/22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, Fyi, I came across this too, presumably it's the same root cause, code below. The error is not happening in Linq V2 btw (so I'm going to use that as a workaround for now).
|