Repository navigation
Check the EF Core major in the differ and generator constructors - #103
Merged
Merged
Conversation
…#91) The major guard ran in every registration entry point, but the differs and the Npgsql SQL generator are public types an application can register itself: ReplaceService<IMigrationsModelDiffer, CustomMigrationsModelDiffer>() constructed the differ on EF Core 11 rc.2, and the first GetDifferences failed with MissingMethodException: IIndex.get_Properties(), naming nothing. The core differ and the Npgsql generator now run the check on their way to the base constructor (EfCoreVersionGuard.Guarded). The PostgreSQL and SQL Server differs construct the core one, so they are covered by the same call. Verified: EfCoreVersionGuardTests gains a row per hand registration (the three differs and the generator, each resolved from a fresh service provider); with both Guarded calls reverted, those four rows fail. No changelog line: the guard is new in 5.5.0 (#55). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 20, 2026
This was referenced Oct 18, 2026
Merged
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.
Closes #91
Problem
The EF Core major guard (#55) runs in every registration entry point, but the differs and the Npgsql SQL generator are public types. An application that registers one itself, e.g.
optionsBuilder.ReplaceService<IMigrationsModelDiffer, CustomMigrationsModelDiffer>(), passes no entry point: on EF Core 11 rc.2 the differ constructs, and the firstGetDifferencesfails withMissingMethodException: …IIndex.get_Properties(), which names neither the cause nor the successor package.Change
EfCoreVersionGuard.Guarded(argument): runsThrowIfUnsupported()and returns its argument, so a primary constructor can run the check on its way to the base constructor (before EF's own constructor runs).CustomMigrationsModelDifferpasses its first base argument through it. The PostgreSQL and SQL Server differs construct the core one, so the one call covers all three;NpgsqlComplexIndexMigrationsModelDiffer.csis untouched (stream B owns it).NpgsqlComplexIndexSqlGeneratordoes the same.docs/upgrading.md: the EF Core 11 section says the hand-registered differs and generator check too.No changelog line: the guard is new in 5.5.0, and CONTRIBUTING.md leaves out fixes to something new in the same release. The 5.5.0
Breakingline already says every registration route throws.Tests
EfCoreVersionGuardTestsgains four rows, one per hand registration:ReplaceServicefor each of the three differs and for the Npgsql generator, resolved from a context with service-provider caching off, so no cached instance can pass a row without constructing it. With EF Core 11 fed they throw the guard's message, and with EF Core 10 they resolve.Verified by reverting: with both
Guardedcalls removed, the four new rows fail and the other 29 pass. Full unit suite: 395 passed.🤖 Generated with Claude Code