-
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
Calling ICollection<>.Contains() with a nested propery throws an InvalidOperationException #4394
Comments
@maumar is this covered by an issue you are working on? |
@mikary can you see if this is fixed |
I tried to reproduce the issue with Northwind: [ConditionalFact]
public virtual void ContainsRepro()
{
using(var context = CreateContext())
{
var orderIds = new int[] { 10248, 11077 };
var query = from x in context.OrderDetails
where orderIds.Contains(x.Order.OrderID)
select x;
var y = query.ToList();
}
} It doesn't appear to throw, but it also doesn't use the code path for the issues around contains that I had fixed. This may have been fixed by a different change. |
So we can close it? |
The repro looks pretty straight forward and I don't believe there's anything specific to the model that would cause this kind of error. |
What is the alternative way to perform that query, since RC2 is not coming out soon? |
I wasn't able to reproduce the original issue, but it might work if you try with something like this: long[] schoolIDs = new long[] { 789, 999 };
var query = from x in context.Students
join t in context.Teachers on x.TeacherID equals t.TeacherID
where schoolIDs.Contains(t.SchoolID)
select x; If you are still having problems, please provide a reproduction of the issue along with the model and full stack trace so we can better diagnose the problem |
@mikart thanks. I'm sure the bug is there in rc1 so I wait for rc2 to test and repot again. For now I use another way. |
Here's a complete repro:
|
@Thealexbarney thanks, I just verified this against our current dev branch and it works (no exception) |
The following query will work
But this query will not
It will throw an InvalidOperationException: Sequence contains more than one element.
Possibly the same as #153
The text was updated successfully, but these errors were encountered: