[rc2] Fix null reference exception in migrations when string has invalid store type#36669
[rc2] Fix null reference exception in migrations when string has invalid store type#36669AndriySvyryd merged 7 commits intorelease/10.0from
Conversation
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
AndriySvyryd
left a comment
There was a problem hiding this comment.
@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.
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.