You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[clr-ios] Track IL-stripping issues for CoreCLR on Apple mobile #130620
The SDK enables PublishReadyToRunStripILBodies by default for iOS-like CoreCLR composite ReadyToRun publishing. Crossgen2 strips the IL body of a non-generic method when the method definition appears in CompiledMethodDefs, but the CoreCLR interpreter can still need that IL when the compiled body cannot be used at run time.
This currently affects user-reachable scenarios.
Methods with opportunistic instruction-set code can carry a per-method instruction-set support fixup. For example, Crc64ParameterSet.ForwardCrc64.InitializeVectorized checks Pclmulqdq, Aes, and AdvSimd support. When run-time instruction-set support differs from the ReadyToRun baseline assumptions, the fixup rejects the compiled body and the interpreter recompiles the method from IL. A stripped body then fails at run time.
Assemblies loaded dynamically or through a custom or collectible AssemblyLoadContext may not be able to use code from the original composite image. The interpreter must compile those methods from IL. This affects patterns exercised by AppDomain.ExecuteAssembly, System.Runtime.Loader, DispatchProxy, and reflection-based serializers.
Generated test entry points can also reach the interpreter after their IL was stripped, as seen with the Regression_o_2 merged runner.
#130360 and #130468 disable IL stripping for affected test projects so CI can exercise these features. These project-level opt-outs prevent the failures but do not protect applications because stripping remains enabled by default. The runtime-async variant case was fixed directly in #130468 and is not part of the remaining work.
Proposed fix
Update the stripping policy so IL remains available whenever the interpreter can be the run-time fallback.
Preserve IL for methods whose ReadyToRun code carries a per-method instruction-set support fixup that can reject the compiled body.
Define and implement safe stripping behavior for assemblies that may be loaded dynamically or into a custom or collectible AssemblyLoadContext.
Add focused ReadyToRun and interpreter regression coverage for both paths.
changed the title [-]Track IL-stripping correctness for CoreCLR interpreter fallback[/-][+][clr-ios] Track IL-stripping issues for CoreCLR on Apple mobile[/+]on Jul 13, 2026
The remaining custom and collectible AssemblyLoadContext scenarios need an explicit assembly-level opt-out. One option is adding an SDK item that preserves IL bodies for selected assemblies while retaining stripping for the rest of the application.
The SDK would pass these assemblies to Crossgen2, which would keep all IL bodies in the matching component assemblies. This provides a bounded solution for plugins and reloadable components without disabling PublishReadyToRunStripILBodies for the entire application. This API is only a proposal and is not currently implemented.
It should be very rare for mobile apps to use multiple load contexts. If the app really wants to have multiple assembly load contexts, the composite R2R mode won't work for the assemblies loaded in the secondary load context. The app would have to disable the composite mode - for the assemblies loaded in the secondary load contexts at least - but then the IL stripping won't work either since it is supported for composite mode only currently.
We should keep it simple unless we hear about actual customer scenarios:
Avoid multiple load contexts in mobile apps
If the mobile app has a good reason for using multiple load context, it should opt ouf assemblies loaded into secondary load contexts from R2R using PublishReadyToRunExclude.
Activity
dotnet-policy-service commentedon Jul 13, 2026
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.
dotnet-policy-service commentedon Jul 13, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli
See info in area-owners.md if you want to be subscribed.
[-]Track IL-stripping correctness for CoreCLR interpreter fallback[/-][+][clr-ios] Track IL-stripping issues for CoreCLR on Apple mobile[/+]kotlarmilos commentedon Jul 14, 2026
The remaining custom and collectible
AssemblyLoadContextscenarios need an explicit assembly-level opt-out. One option is adding an SDK item that preserves IL bodies for selected assemblies while retaining stripping for the rest of the application.The SDK would pass these assemblies to Crossgen2, which would keep all IL bodies in the matching component assemblies. This provides a bounded solution for plugins and reloadable components without disabling
PublishReadyToRunStripILBodiesfor the entire application. This API is only a proposal and is not currently implemented.jkotas commentedon Jul 14, 2026
It should be very rare for mobile apps to use multiple load contexts. If the app really wants to have multiple assembly load contexts, the composite R2R mode won't work for the assemblies loaded in the secondary load context. The app would have to disable the composite mode - for the assemblies loaded in the secondary load contexts at least - but then the IL stripping won't work either since it is supported for composite mode only currently.
We should keep it simple unless we hear about actual customer scenarios:
PublishReadyToRunExclude.