Repository navigation
Description
Description
CoreCLR embeds src/coreclr/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.xml unconditionally. That XML substitutes RuntimeFeature.IsDynamicCodeCompiled with true when IsDynamicCodeSupported is enabled, even when CoreLib was built without FEATURE_DYNAMIC_CODE_COMPILED.
This contradicts RuntimeFeature.NonNativeAot.cs, whose CoreCLR getter explicitly returns false without that feature. Browser CoreCLR supports dynamic code through its interpreter but does not dynamically compile it.
This is a trimming configuration bug, not an R2R-only failure. Both aggressively trimmed R2R and clean aggressively trimmed non-R2R library runs fail the same two existing RuntimeFeatureTests.
Reproduction Steps
Build browser CoreCLR and its libraries/packs, then run the existing Runtime tests with trimming enabled:
XHARNESS_COMMAND=test-browser ./dotnet.sh build /t:Test \
src/libraries/System.Runtime/tests/System.Runtime.Tests/System.Runtime.Tests.csproj \
/p:TargetOS=browser /p:TargetArchitecture=wasm /p:RuntimeFlavor=CoreCLR /p:Configuration=Release \
/p:PublishReadyToRun=false /p:EnableAggressiveTrimming=true \
/p:Scenario=WasmTestOnChrome /p:InstallChromeForTests=true \
'/p:WasmTestAppArgs=-method System.Runtime.CompilerServices.Tests.RuntimeFeatureTests.DynamicCode_Browser -method System.Runtime.CompilerServices.Tests.RuntimeFeatureTests.DynamicCode'The library-test trimming configuration uses the existing mobile test descriptors, as part of #133193. The same failures occur with PublishReadyToRun=true.
Expected behavior
RuntimeFeature.IsDynamicCodeCompiled remains false for interpreter-only browser CoreCLR, and its direct getter agrees with RuntimeFeature.IsSupported("IsDynamicCodeCompiled").
Actual behavior
[FAIL] RuntimeFeatureTests.DynamicCode_Browser
Assert.False() Failure
Expected: False
Actual: True
[FAIL] RuntimeFeatureTests.DynamicCode
Assert.Equal() Failure
Expected: True
Actual: False
The embedded substitution contains:
<type fullname="System.Runtime.CompilerServices.RuntimeFeature" feature="System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported" featurevalue="true">
<method signature="System.Boolean get_IsDynamicCodeCompiled()" body="stub" value="true" />
</type>Regression?
Unknown. The non-JIT getter was introduced separately from the unconditional substitution. The issue is exposed by enabling browser library-test trimming.
Known Workarounds
Do not apply this JIT-specific substitution when FeatureDynamicCodeCompiled is not true. The original getter already has the correct false implementation for those builds.
Configuration
Browser-wasm CoreCLR Release, macOS arm64 build host, Chromium 153.0.8010.0. Runtime base 798449390515fa02f4b20160bedc5e34f8fbdfb9, with publishing prerequisite #133378 (245cb70d593f2c8f3a4e23bcc422e7da5926e15b).
Other information
Found during #133193. The two existing RuntimeFeature tests should remain enabled; the trimming configuration should be corrected instead of quarantining them.
Note
This issue was generated by GitHub Copilot from local test results and source inspection.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dotnet-policy-service commentedon Sep 10, 2026
Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.
Fix CoreLib trimming substitutions for interpreter-only CoreCLR (#133639