-
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
EF Core 2.1: InvalidOperationException while adding or retrieving object graph #12227
Comments
Notes for triage: I investigated this and it looks like the root cause is:
|
@grayver Did you find any workaround for this issue? |
Unfortunately no.. I upgraded all my projects to .NET Core 2.1, except EntityFramework packages. They are still 2.0 |
…ships Fixes #12227 This issues happens when the principal side of multiple relationships is using inheritance and the relationships share and FK property and principal key definition. In this case, the FK value may match instances that are not of the correct type for the given relationship. This would normally be an error and we started throwing for it in 2.1. But it is not an error if the principal is correct for some other relationship sharing the same FK property. So the fix here is to check all the FKs to see if any one can be used. If so, then no problem. If not, then still an error to catch the common case. No matches is also okay, since we don't know whether the principal is loaded or not. Note that technically, GetPrincipal is broken and should be fixed with new API surface to get all possible principals, but not doing this here because it would be new API in a patch.
Patch is approved. |
We're hitting the same issue - is there a preview release that we can try? How far away is the patch? Thanks. |
Disable GroupBy_Composite_Select_Dto_Sum_Min_Key_flattened_Max_Avg, flakiness seems external to EF Fixes #12664
Disable GroupBy_Composite_Select_Dto_Sum_Min_Key_flattened_Max_Avg, flakiness seems external to EF Fixes #12664
Disable GroupBy_Composite_Select_Dto_Sum_Min_Key_flattened_Max_Avg, flakiness seems external to EF Fixes #12664
Disable GroupBy_Composite_Select_Dto_Sum_Min_Key_flattened_Max_Avg, flakiness seems external to EF Fixes #12664
@optiks The patch should come out soon. You can try a preview version from https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/20180711-01/final/index.json |
I have a project with complex data model structure. It works fine with EF Core 2.0. But after upgrading to EF Core 2.1 I get errors on adding or retrieving object graph from database:
Steps to reproduce
I prepared example project which stably reproduces this error:
https://github.com/grayver/efcore21-query-bug
Further technical details
EF Core version: 2.1.0
Database Provider: Npgsql.EntityFrameworkCore.PostgreSQL, Microsoft.EntityFrameworkCore.InMemory
Operating system: Windows 10 version 1803 (OS Build 17134.48)
IDE: Visual Studio 2017 version 15.7.3
The text was updated successfully, but these errors were encountered: