[release/10.0] Fix ComplexProperty treated as nullable after update from EF Core 9.0 to 10.0#38045
Open
Copilot wants to merge 1 commit intorelease/10.0from
Open
[release/10.0] Fix ComplexProperty treated as nullable after update from EF Core 9.0 to 10.0#38045Copilot wants to merge 1 commit intorelease/10.0from
Copilot wants to merge 1 commit intorelease/10.0from
Conversation
Copilot
AI
changed the title
[WIP] Fix ComplexProperty treatment as nullable after EF Core update
Fix ComplexProperty treated as nullable after update from EF Core 9.0 to 10.0
Apr 4, 2026
AndriySvyryd
reviewed
Apr 8, 2026
Member
|
@copilot Update progress using the servicing template |
Contributor
Author
Updated the PR description with the servicing template format, including Description, Customer impact, How found, Regression, Testing, and Risk sections. |
4075768 to
c233e99
Compare
There was a problem hiding this comment.
Pull request overview
This PR adjusts EF Core design-time snapshot processing to ensure complex properties from EF Core 8.x/9.x snapshots are treated as non-nullable when loaded in EF Core 10.0, addressing false model-diff detection caused by property-bag complex types using Dictionary<string, object> as the snapshot CLR type.
Changes:
- Removed the
!complexProperty.ClrType.IsNullableType()guard so the pre-10 snapshot fix applies to property-bag complex properties. - Added a regression test covering property-bag complex property nullability update through
SnapshotModelProcessor.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/EFCore.Design/Migrations/Internal/SnapshotModelProcessor.cs | Broadens the pre-10 snapshot nullability fix to apply regardless of complex property CLR type. |
| test/EFCore.Design.Tests/Migrations/Design/SnapshotModelProcessorTest.cs | Adds coverage for property-bag complex property nullability fixup when processing 9.x snapshots. |
Member
roji
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #38043
Description
Upgrading from EF Core 9.0 to 10.0 with complex properties causes false
PendingModelChangesWarningduringMigrateAsyncand spurious migrations.The previous fix (#37690) for this included a guard that was incorrect and the fix didn't apply for most snapshots.
Customer impact
When upgrading from EF Core 9.x to 10.0 with complex properties:
MigrateAsync()throwsPendingModelChangesWarningat startup, blocking the applicationdotnet ef migrations addgenerates spuriousAlterColumnwitholdNullable: trueWorkaround: suppress
RelationalEventId.PendingModelChangesWarningviaConfigureWarnings, or generate and revert the spurious migration to update the snapshot model. The workaround is discoverable from the exception message.How found
Customer reported on EF 10.0.5.
Regression
Yes, regression from EF Core 10.0.0 when optional complex property support was added. The first fix attempt (PR #37690, commit c214374) was incomplete.
Testing
Added unit test
Risk
Very low. The fix removes an incorrect condition from a guard clause — a one-line change in design-time code.