Skip to content

build: retarget main to .NET 11 for 11.0.0-preview.1 - #292

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
build/103-net11-preview-1
Oct 19, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
build/103-net11-preview-1

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes CaffeinatedCoder/EFCore.ComplexIndexes#103, closes #286, closes #287, closes #289, closes #290, closes #291.

Problem

v10.0.0 is tagged and release/10.x is cut, so main is the 11 line (CONTRIBUTING, "At the v10.0.0 tag"), still saying Version 10.0.0 on net10.0.

Change

Tests

  • Every suite on the .NET 11 RC2 SDK: core 1397, NodaTime 238, EF translation 291, NodaTime EF 83, ASP.NET Core 92, conventions 403, integration 276 + 4 (Docker, PostgreSQL 16), all passing.
  • test/consumer-smoke-test.sh against the packed feed with the .NET 11 SDK, including the Native AOT consumer: passes (the ComplexIndexes consumer skips with its reason).
  • Each fix proved by revert: the hour-24 rows, RangeSet_Contains_*, NullIf_OverAServerSideUnion_IsRefusedAsEquality, ExecuteUpdateGuardTests and the empty-collection SQL each fail with the fix stripped and pass with it; the AOT leg stops at aot-float64set-wrapper-read without the IFormattable implementations.
  • The two oracle seeds that patch the interceptor were refreshed against the new composition; OracleSeedTests passes.

🤖 Generated with Claude Code

The 11 line opens on main, as CONTRIBUTING's "At the v10.0.0 tag" says: net11.0 in
the four shipping projects and every test project, EF Core 11 RC1 (the version
Npgsql.EntityFrameworkCore.PostgreSQL 11.0.0-rc.1.1 pins exactly) and the Npgsql
EF 11 RC, the ASP.NET and Extensions packages at RC2, the SDK at 11.0.100-rc.2 in
global.json and 11.0.x in the release workflow's publish job. Version moves to
11.0.0-preview.1, PackageValidationBaselineVersion to 10.0.0, SECURITY.md's row to
10.0.x, and the five changelogs get their preview section. All four packages
target net11.0, one TFM per line.

Package validation cannot pair a net11.0 asset with the net10.0 baseline (PKV006
and no member comparison), so Directory.Build.props ignores the baseline's
framework with the reason, and a dotnet apicompat run over the four 10.0.0
assemblies against this build found no breaking changes; the mechanical gate
returns when 11.0.0 is the baseline.

EFCore.ComplexIndexes.PostgreSQL has no 11 preview yet (5.4.1 pins Npgsql EF to
[10.0.0, 11.0.0)), so ComplexIndexesCrossTests and the fourth smoke consumer are
conditioned on net10.0 until CaffeinatedCoder/EFCore.ComplexIndexes#38 and #42.

The four behaviour changes #103 measured are held by EfCore11RetargetTests
(integration) and EfCore11ShapeTests (translation): EF Core writes a null JSON
property itself (HandlesNullWrites stays false); RuntimeConstantExpression is
created after translation, so the variant-typed constant still reaches the
retyper; NULLIF, which EF Core 11 writes for `a == b ? null : a`, gets its own
arm in ValueSetSqlGuard and is refused as equality; Npgsql 11's compatibility
target 16 leaves the timerange and multirange SQL unchanged.

Five more changes the first test run found, each with its issue:

- #286: .NET 11 reads an hour of 24 (24:00:00 as midnight, T24:00:00 as the next
  day) where .NET 10 refused it; IsoTemporal refuses it on both platforms.
- #287: EF Core 11 rewrites every Contains on an IReadOnlyCollection into
  Queryable.Contains over the element type and threw ArgumentException for
  RangeSet.Contains(T) and Contains(RangeSet); the interceptor hands the three
  overloads over as static RangeSetContains calls, which translate to @> as
  before. The same change reaches EF Core 10 in a patch after 10.0.13 (#288).
- #289: Npgsql 11 writes a JSON setter that may be null through jsonb_set_lax,
  which the guard did not match (the refusal lost its path), and writes the null
  outcome as JSON null, so the "whole document" reason is gone from the messages.
- #290: EF Core 11 replaces an empty VALUES parameter with a SELECT of bare NULLs,
  which PostgreSQL types as text ("operator does not exist: text && int4range");
  EmptyCollectionRewriter now casts those NULLs to the column's type instead of
  rewriting a VALUES it no longer sees.
- #291: under Native AOT with ILCompiler 11 RC2, every set type's ToString trapped
  (SIGTRAP) in the instantiating stub of IValueSetFactory's default
  IFormattable.ToString; every set type implements IFormattable itself now.
  Reported upstream as dotnet/runtime#136073.

Each fix was proved by reverting it and watching its test fail. The two oracle
seeds that patch the interceptor are refreshed against the new composition.

Closes #103
Closes #286
Closes #287
Closes #289
Closes #290
Closes #291

Found-By: OT
Found-By: SM
Defect-Class: LIT
Defect-Class: SQL
Co-Authored-By: Claude Fable 5.1 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Oct 19, 2026
@CaffeinatedCoder CaffeinatedCoder added chore Build, CI, packaging, refactoring with no behaviour change package/nodatime Affects CodoMetis.ValueRanges.NodaTime package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL area/release Versioning, changelogs, release wiring package/core Affects CodoMetis.ValueRanges package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime labels Oct 19, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit ca245fe into main Oct 19, 2026
@CaffeinatedCoder
CaffeinatedCoder deleted the build/103-net11-preview-1 branch October 19, 2026 11:21
This was referenced Oct 19, 2026
CaffeinatedCoder added a commit that referenced this pull request Oct 19, 2026
… .NET 11 SDK does not trap

ILCompiler 11 RC2 compiles the instantiating stub for the default
IFormattable.ToString of IValueSetFactory<TSet, T> to a trap, and every set
type's ToString() ran through that default, so a net11.0 Native AOT consumer
of the released 10.0.0 packages ended with SIGTRAP (exit 133, nothing on
stderr) on the first value set ToString. #299 is the 10.x issue; #291 measured
it on the 11 line, against the unchanged 10.0.0 package too, and reported it
upstream as dotnet/runtime#136073.

Every set type - the twelve core families and their wrapper arities, and the
five NodaTime families - implements IFormattable.ToString explicitly as
SetFormat.Format<TSet, T>(this, format, provider), and its ToString() calls
SetFormat.Format directly, so the interface's default is never the
implementation a compiled consumer runs. The interface keeps its default.
Explicit interface implementations leave the public surface unchanged, and
the ApiCompat baseline against 10.0.0 passes in dotnet pack. The change is the
one PR #292 made on main; #292 is one commit (231f23a) holding the whole .NET
11 retarget, so this is a hand-extracted commit naming it rather than a
cherry-pick -x. The clone sweep (tools/oracles.cs clones) reports no new
divergence: every family changed the same way.

test/consumer-smoke-test.sh gains SMOKE_AOT_SDK, which pins the AOT consumer
to an installed .NET SDK through a global.json written beside it before
dotnet new, and targets that SDK's framework, so the publish runs that SDK's
ILCompiler over the net10.0 packages. The header says how to run it with a
.NET 11 SDK installed beside the .NET 10 one the repository's global.json
needs. The AOT leg now also fails on a non-zero exit of the native binary, and
one case prints every value set family's ToString. Measured with SDK
11.0.100-rc.2.26504.105 on osx-arm64: against a pack of the branch without
this change (48b9651) the native binary exited with 133 after printing
aot-float64set, where #291 saw it stop; with this change it runs to the end,
the new case prints all seventeen families, and the smoke test passes. The
.NET 10 SDK run, which is what CI does, is unchanged and green.

Issue #299, fixed on release/10.x only; closed by hand after the merge, since
a closing keyword acts only on main.

Found-By: SM
Defect-Class: PKG
Co-Authored-By: Claude Fable 5.1 <[email protected]>
CaffeinatedCoder added a commit that referenced this pull request Oct 19, 2026
IsoTemporal handed element text to TimeOnly.TryParseExact, DateTime.TryParseExact and
DateTimeOffset.TryParseExact. .NET 11 accepts an hour of 24 there where .NET 10 refuses
it, and this net10.0 assembly runs on the .NET 11 runtime inside a net11.0 application,
so the released 10.0.0 read `{24:00:00}` as `{00:00:00}` and `T24:00:00` as the next
day's midnight there, silently, while throwing FormatException on .NET 10.

IsoTemporal now refuses an hour of 24 before the BCL parse, for a time, a DateTime and
a DateTimeOffset, so a literal means the same on every runtime. Ported by hand from
PR #292 (231f23a, the #286 fix on main), with the TemporalLiteralGrammarTests rows
`24:00`, `24:00:00.0`, `T24:00:00`, ` 24:00`, `T24:00:00Z` and ` 24:00:00+05:30:00`.

Proved on the .NET 11.0.0-rc.2 runtime, the net10.0 test assembly run under
vstest.console with --roll-forward Major: without the fix Time_Rejects("24:00:00") and
the six new rows fail (7 of 115); with it all 115 pass, and the whole core project
passes on .NET 10.0.13 and 11.0.0-rc.2 alike. On .NET 10 the rows pass both ways.

A silent fix, so 10.1.0 is a minor: the root and core changelogs open the 10.1.0
section with "Changed answers", one row linking #300 and the new "Changed answers in
10.1.0" section of docs/migration.md, which says how to find the text whose reading
changed. docs/serialization.md's grammar list names the rule.

Found-By: OT
Defect-Class: LIT
Co-Authored-By: Claude Fable 5.1 <[email protected]>
CaffeinatedCoder added a commit that referenced this pull request Oct 19, 2026
… read-only collection

The EF Core 10 patch that carries dotnet/efcore#37081 (dotnet/efcore#39114, milestone
10.0.15) makes QueryableMethodNormalizingExpressionVisitor rewrite every one-argument
method named Contains on an IReadOnlyCollection<T> into Queryable.Contains over the
collection's element type, before any translator runs. RangeSet<TRange, T> is an
IReadOnlyList<TRange> whose Contains overloads take a T, an IRange<T> or a RangeSet, so
on that patch every RangeSet.Contains in a query threw ArgumentException inside EF Core.
EF Core 10.0.0 through 10.0.13 rewrite only ICollection<T>, which is why the floor this
repository's CI pins never saw it (#297); Npgsql EF 10.0.1-10.0.3 require EF Core >= 10.0.4,
so a consumer reaches the patch with a plain restore. Reported upstream as
dotnet/efcore#39329.

The query interceptor now turns the three instance overloads into static methods on
RangeSetContains, a declaring type that is not a collection and that EF Core's rewrite
therefore leaves alone, and ValueRangesMethodCallTranslator translates that form to @>
exactly as the instance call. Each static method calls the instance method it stands for,
so a client-evaluated call answers as the set does. Public API unchanged. This is the fix
PR #292 made on main for the 11 line (#287), ported by hand: #292 is one commit holding
the whole .NET 11 retarget, so there is no commit to cherry-pick.

No published EF Core 10 patch carries the change yet (the dnceng dotnet10 feed answers
but lists no 10.0.x servicing build), so the proof is the query tree rather than the SQL.
RangeSetContainsShapeTests and NodaRangeSetContainsShapeTests read the query as the
interceptor hands it over (InterceptedQuery, through the logger call
QueryCompilationContext makes) and assert that no instance Contains whose declaring type
implements IReadOnlyCollection<> survives, that exactly one RangeSetContains call stands
in its place, and that the SQL is still @>, for the three overloads on the BCL date and
integer sets and on the NodaTime LocalDate, Instant and YearMonth sets. With the rewrite
stripped from the interceptor the 5 and 8 tree tests fail and every @> SQL test still
passes, on EF Core 10.0.0 and with the test hosts floated to EF Core 10.0.13 / Npgsql EF
10.0.3, which is exactly why the SQL tests could not see the defect. With it, 295/295 and
91/91 translation tests pass on both, and 280 + 4 integration tests pass on PostgreSQL 16.

The two CompareTo seeds under test/oracles/seeds that diff the interceptor's chain and
remarks are refreshed to the new context, as #292 did on main. The changelog line names
the patch and the stopgap AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue37081",
true), whose cost is EF Core's own fix for IReadOnlySet parameters.

Issue #288, fixed on release/10.x only (main has #287 through #292); closed by hand after
the merge, since a closing keyword acts only on main.

Found-By: OT
Defect-Class: SQL
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/release Versioning, changelogs, release wiring chore Build, CI, packaging, refactoring with no behaviour change package/core Affects CodoMetis.ValueRanges package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime package/nodatime Affects CodoMetis.ValueRanges.NodaTime

Projects

None yet

1 participant