Repository navigation
Fix nullable value comparer type arguments in compiled models - #39292
Merged
Merged
Conversation
Co-authored-by: AndriySvyryd <[email protected]>
Copilot
AI
changed the title
[WIP] Fix error CS0453 in nullable property ValueComparer
Fix nullable value comparer type arguments in compiled models
Oct 16, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved blocking issues were identified.
No open issues 🎉
What changed in this PR
Fixes compiled-model generation for nullable properties using non-nullable struct value comparers.
Changes:
- Generates
NullableValueComparer<T>with the comparer’s value type. - Adds regression coverage for nullable and non-nullable comparer scenarios.
- Updates the compiled-model baseline.
| File | Description |
|---|---|
test/EFCore.InMemory.FunctionalTests/Scaffolding/CompiledModelInMemoryTest.cs |
Adds comparer behavior regression tests. |
test/EFCore.InMemory.FunctionalTests/Scaffolding/Baselines/Custom_value_comparer/MyEntityEntityType.cs |
Updates generated-model baseline expectations. |
src/EFCore.Design/Scaffolding/Internal/CSharpRuntimeModelCodeGenerator.cs |
Corrects generated comparer generic type arguments. |
Review effort: Lite
Code coverage overviewLanguages: C# C# / code-coverage
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
AndriySvyryd
enabled auto-merge (squash)
October 31, 2026 00:27
cincuranet
approved these changes
Nov 4, 2026
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.
A struct’s
ValueComparer<T>works with nullable properties at runtime, but compiled models use the comparer class asNullableValueComparer<>’s type argument, causing CS0453.NullableValueComparer<TComparer>(CS0453) for a struct's ValueComparer applied to a nullable property #39291