[release/11.0] Validate unsupported SQL Server JSON index options - #39090
Merged
AndriySvyryd merged 4 commits intoSep 26, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix issue with IsUnique() on JSON mapped index in SQL Server
Validate unsupported SQL Server JSON index options
Sep 24, 2026
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Validation incorrectly rejects harmless explicit defaults such as nonclustered indexes and empty include lists.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds SQL Server model validation to prevent unsupported JSON index options from being silently ignored.
Changes:
- Validates JSON index options during model finalization.
- Adds provider-specific diagnostics.
- Adds supported and unsupported option tests.
| File | Description |
|---|---|
SqlServerModelValidator.cs |
Validates JSON index options. |
SqlServerStrings.resx |
Adds validation error text. |
SqlServerStrings.Designer.cs |
Exposes the generated error resource. |
SqlServerModelValidatorTest.cs |
Tests option validation. |
Files not reviewed (1)
- src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Generated file
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
AndriySvyryd
force-pushed
the
copilot/fix-sql-server-json-index-unique
branch
from
September 25, 2026 00:50
ff9645f to
a563b93
Compare
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
AndriySvyryd
force-pushed
the
copilot/fix-sql-server-json-index-unique
branch
from
September 25, 2026 01:01
a563b93 to
6eb9bad
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused validation matches SQL Server JSON-index constraints and has comprehensive unit coverage.
Review effort: Balanced
Findings: None
Resolved since last review (1)
Files not reviewed (1)
- src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Generated file
AndriySvyryd
marked this pull request as ready for review
September 25, 2026 01:30
SamMonoRT
approved these changes
Sep 25, 2026
artl93
approved these changes
Sep 25, 2026
artl93
left a comment
Member
There was a problem hiding this comment.
Approved. New area. Customer reported.
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 #39065
Description
SQL Server JSON indexes cannot express several options supported by ordinary indexes. EF Core generated
CREATE JSON INDEXwhile silently dropping options such as uniqueness and descending order, or emitted clauses that SQL Server does not support. This change validates JSON index configuration and reports an error identifying the index and unsupported option. It continues to allow supported options and harmless explicit defaults, including fill factor, non-clustered, no include properties, offline creation, and disabled tempdb sorting.Customer impact
Applications could configure a JSON-member index as unique but receive a non-unique database index, allowing duplicate values despite the model constraint. Other unsupported options could produce SQL that fails when a migration is applied. There was no warning that the intended constraint had been discarded.
How found
User reported on EF Core 11.0.0-rc1 .
Regression
No, SQL Server JSON index support was introduced in EF Core 11.
Testing
Tests added.
Risk
Low. SQL generation is unchanged. The validation only rejects options that SQL Server JSON indexes cannot express.