Repository navigation
fix: implement IFormattable on every value set so Native AOT with the .NET 11 SDK does not trap - #309
Merged
CaffeinatedCoder merged 2 commits intoOct 19, 2026
Conversation
… .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
enabled auto-merge
October 19, 2026 12:10
Resolves the core changelog conflict with #308: the 10.1.0 section opens with Changed answers (#300), then Fixed (#299). Co-Authored-By: Claude Fable 5.1 <[email protected]>
CaffeinatedCoder
force-pushed
the
fix/299-aot-set-tostring-net11-sdk
branch
from
October 19, 2026 12:11
1a9c970 to
089863c
Compare
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 #299
Against
release/10.x, on top of #305 (which opened## [10.1.0]) and #306. #299 is fixed only onrelease/10.x(mainhas the 11-line original, #291, in #292), soCloseswill not act: close it by hand after the merge, with a link here.Problem
ILCompiler 11 RC2 compiles the instantiating stub for the default
IFormattable.ToStringofIValueSetFactory<TSet, T>to a trap (dotnet/runtime#136073), and every set type'sToString()runs through that default. Anet11.0Native AOT consumer published with the .NET 11 SDK dies withSIGTRAP(exit 133, nothing on stderr) on the first value setToString()— against the released 10.0.0 packages too, as #291 measured. 10.x is supported to 2028-11 and 11.x carries a breaking surface change (#275), so applications that move to .NET 11 and keep the 10.x packages are expected. Loud, not silent. This repository's CI has no .NET 11 SDK, so it did not see it (#297).Change
src/CodoMetis.ValueRanges/Sets/*.cs(twelve families, each with its wrapper arity) andsrc/CodoMetis.ValueRanges.NodaTime/Sets/*.cs(five families): every set type implementsIFormattable.ToString(string?, IFormatProvider?)explicitly asSetFormat.Format<TSet, T>(this, format, provider), and itsToString()callsSetFormat.Format<TSet, T>(this, null, CultureInfo.InvariantCulture)directly, with a comment naming 10.x: Native AOT published with the .NET 11 SDK traps (SIGTRAP) on the first value setToString(dotnet/runtime#136073) #299. The interface keeps its default. This is the change PR build: retarget main to .NET 11 for 11.0.0-preview.1 #292 made onmain(one commit, 231f23a, holding the whole .NET 11 retarget), hand-extracted and applied identically to every sibling; not acherry-pick -x. Explicit interface implementations leave the public surface unchanged: the ApiCompat baseline against 10.0.0 passes indotnet pack -c Release, anddotnet run tools/oracles.cs clonesreports 180 divergences, all waived, none new.test/consumer-smoke-test.sh:SMOKE_AOT_SDKpins the AOT consumer to an installed SDK through aglobal.jsonwritten beside it beforedotnet new, and targets that SDK's framework (net11.0), 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'sglobal.jsonneeds (both into one folder withdotnet-install.sh, that folder first on PATH) — 10.x: Native AOT published with the .NET 11 SDK traps (SIGTRAP) on the first value setToString(dotnet/runtime#136073) #299's done-when, the check to repeat by hand until 10.x CI: run the EF Core suites on the newest EF Core / Npgsql 10 patch and the daily servicing builds, not only the floor #297. The AOT leg now fails on a non-zero exit of the native binary (a trap after the last asserted line passed before), prints which SDK published, and a new caseaot-set-tostring-every-familyprints every family'sToString.AGENTS.md: the knob, in the smoke test's description.CHANGELOG.md,src/CodoMetis.ValueRanges/CHANGELOG.md,src/CodoMetis.ValueRanges.NodaTime/CHANGELOG.md: one### Fixedline each under## [10.1.0].Tests
SDK
11.0.100-rc.2.26504.105and 10.0.402 installed withdotnet-install.shinto one scratch folder, put first on PATH; osx-arm64.Before —
SMOKE_AOT_SDK=11.0.100-rc.2.26504.105 test/consumer-smoke-test.sh <feed>with the feed packed from 48b9651, this branch's base without the change. The managed run of thenet11.0consumer prints every line; the native binary stops afteraot-float64set, where #291 saw it stop, and the script reports:After — the same command with the feed packed from this branch:
75 assertions, none failing, across the four consumers.
Without
SMOKE_AOT_SDK, from a folder holding only SDK 10.0.402 (thenet10.0consumer with ILCompiler 10, what CI publishes): passes with this branch's feed,aot-set-tostring-every-familyincluded, as it did before the change.dotnet test, all green:🤖 Generated with Claude Code