Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 27, 2025

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.

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI changed the title [WIP] Null reference exception in migrations when string has invalid store type Fix null reference exception in migrations when string has invalid store type Aug 27, 2025
Copilot AI requested a review from AndriySvyryd August 27, 2025 01:54
Copy link
Member

@AndriySvyryd AndriySvyryd left a 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}

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
@AndriySvyryd
Copy link
Member

@copilot Continue

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 27, 2025

@copilot Continue

Continued and completed all remaining tasks:

✅ Moved logic to GetColumnType method with non-nullable return type
✅ Added fallback to operation.DefaultValue type mapping
✅ Added proper exception with table/column info using existing string resource
✅ Updated all callers (no changes needed - already compatible)
✅ Moved tests to FunctionalTests with test for default value fallback
✅ Removed empty test class and InvalidColumnTypeIntegrationTest.cs
✅ Updated PR description with requested template format
✅ Built and tested all changes successfully

Commit cd9ba81

Copilot AI requested a review from AndriySvyryd August 27, 2025 22:17
@AndriySvyryd AndriySvyryd changed the title Fix null reference exception in migrations when string has invalid store type [rc2] Fix null reference exception in migrations when string has invalid store type Aug 27, 2025
@AndriySvyryd AndriySvyryd marked this pull request as ready for review August 27, 2025 23:13
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner August 27, 2025 23:13
…upportedTypeForColumn

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copy link
Member

@artl93 artl93 left a 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

@AndriySvyryd AndriySvyryd merged commit 8d1ea62 into release/10.0 Aug 29, 2025
7 checks passed
@AndriySvyryd AndriySvyryd deleted the copilot/fix-33556 branch August 29, 2025 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Null reference exception in migrations when string has invalid store type

5 participants