Self-referencing entity circular dependency happening just on EF Core 6.0 #26750
Labels
area-save-changes
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
regression
Servicing-approved
type-bug
Milestone
Description
I'm not sure at all if this is a bug. At least I think is an unexpected behavior.
This behavior appeared for the first time after migrating to NET 6. I've managed to reproduce the issue in the simple project composed of the 3 files shown bellow. First I thought it was a breaking change so I reviewed all of them. However, I'm unable to find any breaking change that would cause this error. As I wasn't able to relate the error to any change I started changing efcore version in my .csproj file. As soon as I change to 6.0.0-rc.2.21480.5 for all the packages (efcore) the error doesn't show anymore. Another thing to highlight is that if I add a SaveChanges after the removes in the program.cs file the error won't happen either.
Person.cs
Context.cs
Program.cs
Stack trace
Version information
EF Core version:
Ef Core (Microsoft.EntityFrameworkCore 6.0.0)
Database provider: (Microsoft.EntityFrameworkCore.SqlServer 6.0.0)
Target framework: (.NET 6.0.0)
The text was updated successfully, but these errors were encountered: