-
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
Cosmos DB: NullReferenceException on SaveChanges when saving modified owned collection #13640
Comments
@divega I can fix the exception, but the |
@AndriySvyryd Is this a behavior specifically for owned types? Normally, DetectChanges always marks things as Added, regardless of key value. But I vaguely remember we tried to make some scenarios for owned entities work "better" by special casing what we do in DetectChanges. Is this something we should revisit? |
I'm talking about https://github.com/aspnet/EntityFrameworkCore/blob/master/src/EFCore/ChangeTracking/Internal/EntityGraphAttacher.cs#L73 |
@ajcvickers Nevermind, that wasn't the real root issue. The existing owned entity wasn't tracked after querying due to #13579 and that confused the model differ as it was still part of the relationship snapshot. |
@AndriySvyryd whats the progress on this. I am having the same issue with preview 4 |
@ekjuanrejon The fix depends on #14455 |
#14455 has been merged, does that mean this should be fixed now? Because I am still running into this issue. Is there a workaround I could use meanwhile? |
@TomasHubelbauer That comment indicates that #14455 was required before this could be fixed, but not that this is fixed itself. |
@TomasHubelbauer It's also worth noting that if you're using Cosmos in the 3.0 previews, then there is still a lot of work left to do to get the query overhaul integrated with Cosmos. This won't happen for preview6, so if you are doing this you're probably better off staying on preview5 for now. |
Fixed in 7d4b425 |
Currently |
Found this using nightly builds of Microsoft.EntityFrameworkCore.Cosmos.
Including the repro below. The error does not occur if I only query for the post and then modify the collection and save.
The text was updated successfully, but these errors were encountered: