Skip to content

[release/11.0] Persist null complex properties on TPH siblings with shared columns - #39662

Merged
AndriySvyryd merged 5 commits into
release/11.0from
copilot/fix-ef-core-11-optional-complex-property
Nov 16, 2026
Merged

AndriySvyryd merged 5 commits into
release/11.0from
copilot/fix-ef-core-11-optional-complex-property

Conversation

@AndriySvyryd

@AndriySvyryd AndriySvyryd commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Fixes #39596

Description
Setting an optional complex property to null on TPH sibling types sharing columns marked the entity modified but omitted those columns from the update. The update pipeline now identifies the shared-column writer before skipping propagation into a null complex property.

Customer impact
The old complex-property values remain in the database instead of being cleared, potentially causing data corruption. No workaround on EF Core 11.0.0 is known.

How found
Customer-reported on EF Core 11.0.0

Regression
Regression from EF Core 10.0.x

Testing
Added synchronous and asynchronous regression coverage for both TPH sibling types, unaffected mappings, and restoring a complex value after clearing it.

Risk
Low, the change is limited to shared-column update generation.

AndriySvyryd and others added 2 commits November 15, 2026 03:00
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@AndriySvyryd AndriySvyryd changed the title [WIP] Fix EF Core 11 issue with optional complex property persistence Persist null complex properties on TPH siblings with shared columns Nov 15, 2026
Comment thread .agents/skills/update-pipeline/SKILL.md Resolved
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The update-pipeline ordering change is accompanied by regression coverage for affected and unaffected mappings and documentation of the shared-column invariant.

No open issues 🎉

What changed in this PR

Fixes persistence of nullable complex properties set to null when TPH sibling types share columns. The update pipeline now identifies the column writer before skipping propagation into null complex properties, with regression coverage for affected and unaffected mappings.

Changes:

  • Adjusted shared-column propagation ordering in ModificationCommand.
  • Added regression coverage for sibling TPH types, single-derived and non-inherited entities, and restoring cleared complex values.
  • Documented the shared-column propagation invariant in the update-pipeline skill.
File Description
test/​EFCore.Relational.Specification.Tests/​Update/​NonSharedModelUpdatesTestBase.cs Adds synchronous and asynchronous regression coverage for nulling and restoring complex properties across TPH and non-TPH mappings.
src/​EFCore.Relational/​Update/​ModificationCommand.cs Ensures shared-column writers are identified before null complex property propagation is skipped.
.agents/​skills/​update-pipeline/​SKILL.md Documents the shared-column propagation rule for null complex properties.

Review effort: Lite

@AndriySvyryd AndriySvyryd changed the title Persist null complex properties on TPH siblings with shared columns [release/11.0] Persist null complex properties on TPH siblings with shared columns Nov 15, 2026
@AndriySvyryd
AndriySvyryd marked this pull request as ready for review November 15, 2026 21:20
@AndriySvyryd
AndriySvyryd requested a review from a team as a code owner November 15, 2026 21:20
Copilot AI lite review requested due to automatic review settings November 15, 2026 21:20
@dotnet dotnet deleted a comment from Copilot AI Nov 15, 2026
@dotnet dotnet deleted a comment from Copilot AI Nov 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain, and the change includes targeted synchronous and asynchronous regression coverage for the shared-column clearing and restoration scenarios.

No open issues 🎉

Review effort: Lite

@github-code-quality

github-code-quality Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: C#

C# / code-coverage

release/11.0 a8c2f29 copilot/fix-ef-core-... e246b73 +/-
76% 67% -9%
View coverage of the 10 most impacted files.
File release/11.0 a8c2f29 copilot/fix-ef-core-... e246b73 +/-
/Users/runner/w...nal/Snapshot.cs 0% 60% +60%
D:\a\efcore\efc...nal\Snapshot.cs 0% 64% +64%
/home/runner/wo...nal/Snapshot.cs 0% 66% +66%
/home/runner/wo...yTypeBuilder.cs 0% 88% +88%
D:\a\efcore\efc...yTypeBuilder.cs 0% 88% +88%
/Users/runner/w...ngs.Designer.cs 0% 92% +92%
/home/runner/wo...ctExpression.cs 0% 93% +93%
D:\a\efcore\efc...ctExpression.cs 0% 93% +93%
D:\a\efcore\efc...ngs.Designer.cs 0% 94% +94%
/home/runner/wo...ngs.Designer.cs 0% 95% +95%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 16, 2026 18:21 UTC

@artl93 artl93 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Regression, customer reported. M2 approved.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings November 16, 2026 17:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues remain, and the change includes targeted synchronous and asynchronous regression coverage for clearing and restoring shared-column complex values.

No open issues 🎉

Review effort: Lite

@AndriySvyryd
AndriySvyryd merged commit 086d0a9 into release/11.0 Nov 16, 2026
16 checks passed
@AndriySvyryd
AndriySvyryd deleted the copilot/fix-ef-core-11-optional-complex-property branch November 16, 2026 21:41
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.

EF Core 11: Setting an optional complex property to null is not persisted for TPH sibling types that map the same columns

6 participants