Skip to content

Conversation

@AndriySvyryd
Copy link
Member

Fixes #37373
Port of #37377

Description

EF added support for complex collections in 10, but the update pipeline contains an access pattern that's invalid for deleted entities.

Customer impact

When deleting an entity with a non-empty complex collection, an exception is thrown. A workaround is to clear the complex collections for any deleted entity.

How found

Multiple customer reports on EF 10.0.0

Regression

No, complex collections were introduced in EF 10.

Testing

Tests added

Risk

Low. Quirk added.

@AndriySvyryd AndriySvyryd requested a review from a team as a code owner December 15, 2025 20:25
@A-Stapleton
Copy link

@AndriySvyryd When you say a workaround is to clear the complex collections do you mean clear it and persist changes then in a separate operation delete the parent or just explicitly clear it?

@AndriySvyryd
Copy link
Member Author

@AndriySvyryd When you say a workaround is to clear the complex collections do you mean clear it and persist changes then in a separate operation delete the parent or just explicitly clear it?

Just clear them on any entity being deleted, in the same SaveChanges

@AndriySvyryd AndriySvyryd requested a review from artl93 January 6, 2026 01:07
@AndriySvyryd
Copy link
Member Author

cc @artl93

Copy link
Member

@artl93 artl93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tentatively approved... new feature, multiple customer reports, simple fix.

How obvious is the workaround?

@AndriySvyryd
Copy link
Member Author

The workaround is somewhat discoverable for developers familiar with how SaveChanges is implemented, but so far I haven't seen any reports of it being discovered naturally.

@artl93
Copy link
Member

artl93 commented Jan 6, 2026

Thanks - include that workaround evidence (or lack thereof) in the tactics approval, please.

@AndriySvyryd AndriySvyryd added this to the 10.0.3 milestone Jan 6, 2026
@AndriySvyryd AndriySvyryd merged commit a154024 into release/10.0 Jan 6, 2026
7 checks passed
@AndriySvyryd AndriySvyryd deleted the Issue37373 branch January 6, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants