-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[release/10.0] Always generate HasDiscriminator with type argument and property name in snapshot #37242
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
Open
Copilot
wants to merge
3
commits into
release/10.0
Choose a base branch
from
copilot/fix-hasdiscriminator-call-snapshot
base: release/10.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+66
−13
Conversation
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
…nt and property name Co-authored-by: AndriySvyryd <[email protected]>
Copilot
AI
changed the title
[WIP] Fix snapshot to always generate HasDiscriminator call
Fix #37143: Always generate HasDiscriminator with type argument and property name in snapshot
Nov 26, 2025
Copilot finished work on behalf of
AndriySvyryd
November 26, 2025 02:04
Member
|
@copilot Update progress by rewriting the PR summary using this template: |
Contributor
Author
... Updated the PR description using the requested template. |
Copilot finished work on behalf of
AndriySvyryd
November 27, 2025 00:24
e53830c to
ed302cc
Compare
roji
approved these changes
Nov 27, 2025
cincuranet
approved these changes
Dec 2, 2025
Member
|
cc @artl93 |
artl93
reviewed
Dec 3, 2025
Member
artl93
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Customer Reported regression.
artl93
approved these changes
Dec 3, 2025
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 #37143
Description
When a discriminator property has a non-string type (e.g.,
int) and uses the default property name "Discriminator", the model snapshot generator would omit the type argument. This caused the discriminator type to default tostringwhen reading the snapshot back, resulting in spurious migrations being generated on every scaffold.Customer impact
Customers using non-string discriminator types with the default "Discriminator" property name would see new migrations generated each time they ran
dotnet ef migrations add, even when no actual model changes were made.A workaround is to fix the snapshot manually, but this would need to be performed after every new migration. Another workaround is to use a custom discriminator property name.
How found
Customer reported on 10.0.0.
Regression
Yes, from EF Core 9.0. Introduced in #35744
Testing
Test added
Risk
Low. The change is minimal, only affects snapshot generation output, which is a design-time action
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.