Repository navigation
chore: keep the default IFormattable.ToString of IValueSetFactory out of ILCompiler's inlining - #316
Merged
CaffeinatedCoder merged 1 commit intoOct 19, 2026
Conversation
… of ILCompiler's inlining #299 stopped the Native AOT trap under the .NET 11 SDK by giving each value set family its own IFormattable.ToString, so the interface's default is never the code a consumer runs. That holds only while every family, present and future, carries the override: a family without one compiles, passes every test on the .NET 10 SDK that CI runs, and traps (exit 133, no output) only in a net11.0 Native AOT publish, which only the manual SMOKE_AOT_SDK run exercises. Root cause, from hez2010 on dotnet/runtime#136073: ILCompiler inlines the small default into the instantiating thunk of the shared-generic interface, where the receiver is typed as the thunk's module type, so the cast of `this` fails. This puts their workaround, [MethodImpl(NoInlining)], on the default and keeps the overrides. It changes no public surface and no answer, so there is no changelog entry. Measured with SDK 11.0.100-rc.2.26504.105 on osx-arm64, test/consumer-smoke-test.sh with SMOKE_AOT_SDK, on the 10.0.0 state of the sets (the overrides of e54ed35 reverted): without the attribute the native binary exits with 133 right after aot-float64set, as #291 saw; with only the attribute added it runs to the end and "ToString on every value set family" passes. Removing the overrides of one family alone (GuidSet) does not trap, so the proof needs the whole 10.0.0 state. The smoke run cannot be in CI (#297 gives the 10.x CI no .NET 11 SDK leg), so a conventions test asserts the flag on the default by reflection; it fails with the attribute stripped and passes with it. IValueSetFactory cannot be implemented outside this repository (FromTrusted is internal abstract), so there is no consumer-facing gap; #315 says so. The range default (IRangeFactory) printed every range in the same publish and is left alone. Refs #315, dotnet/runtime#136073 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Oct 19, 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.
Closes #315
Problem
#299 keeps the Native AOT trap under the .NET 11 SDK out of 10.1.0 by giving each of the 17 value set
families its own
IFormattable.ToString, so the default inIValueSetFactory<TSet, T>is never the code aconsumer runs. A family added without that override compiles, passes every test on the .NET 10 SDK that CI
runs, and ends a
net11.0Native AOT publish withSIGTRAP(exit 133, no output) on its firstToString;only the manual
SMOKE_AOT_SDKrun shows it.There is no consumer-facing gap:
IValueSetFactory<,>declaresinternal abstract static FromTrusted, sonothing outside this repository can implement it (CS0535 from a scratch project). #315's first version said
otherwise; it was corrected.
Change
[MethodImpl(MethodImplOptions.NoInlining)]on the defaultIFormattable.ToStringofIValueSetFactory<TSet, T>, which is the workaround hez2010 gave on dotnet/runtime#136073 (ILCompiler inlinesthe default into the instantiating thunk of the shared-generic interface, where the cast of
thisfails). Theper-family overrides stay.
IRangeFactory's default is untouched: it printed every range in the same publishes.No public surface and no answer changes, so there is no changelog line.
Tests
Measured with SDK 11.0.100-rc.2.26504.105 on osx-arm64,
SMOKE_AOT_SDK=… test/consumer-smoke-test.sh:aot-float64setNoInliningGuidSetalone revertedThe smoke leg cannot be in this repository's CI (#297 gives 10.x no .NET 11 SDK leg), so
ValueSetContractTests.TheDefaultToString_OfTheSetFactoryInterface_IsNotInlinedasserts the flag byreflection: it fails with only the attribute stripped (message names #299/#315 and the upstream issue) and
passes with it. The conventions project passes (404).
The same change goes to
mainin a separate PR after this one merges.🤖 Generated with Claude Code