-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[rc2] Fix null reference exception in migrations when string has invalid store type #36669
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
Conversation
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
AndriySvyryd
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.
@copilot Rewrite the PR summary using this template:
Fixes #{number}
**Description**
{Issue description}
**Customer impact**
{How does the reported issue affects customer's app? Are there workarounds?}
**How found**
{Was it customer reported or found during verification? How many customers are affected?}
**Regression**
{Is it a regression from a released version? Which one?}
**Testing**
{How the changes were tested}
**Risk**
{Low/Medium/High, argument why}
test/EFCore.SqlServer.Tests/Migrations/SqlServerMigrationsSqlGeneratorTest.cs
Outdated
Show resolved
Hide resolved
test/EFCore.SqlServer.Tests/Migrations/InvalidColumnTypeIntegrationTest.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
|
@copilot Continue |
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Continued and completed all remaining tasks: ✅ Moved logic to GetColumnType method with non-nullable return type Commit cd9ba81 |
test/EFCore.SqlServer.FunctionalTests/Migrations/SqlServerMigrationsSqlGeneratorTest.cs
Outdated
Show resolved
Hide resolved
…upportedTypeForColumn Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
test/EFCore.SqlServer.FunctionalTests/Migrations/SqlServerMigrationsSqlGeneratorTest.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
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 restoring previous behavior
Fixes #33556
Description
Fixed a NRE that occurs during migrations when a property has an invalid store type by throwing a more helpful exception.
Customer impact
Customers experience NullReferenceException during migrations when their models contain properties with incompatible store type mappings. This would cause migration generation to fail completely, preventing database schema updates. The workaround is to ensure all properties had valid type mappings or manually specify ColumnType, but this was not always clear to users.
How found
Reported by multiple customers on EF8 and EF9.
Regression
Yes, from EF7.
Testing
Test added
Risk
Low. Just throws a different exception.
💡 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.