Skip to content

[clr-ios] Disable R2R IL-body stripping for library tests that need IL at run time#130360

Merged
kotlarmilos merged 1 commit into
dotnet:mainfrom
kotlarmilos:dev/kotlarmilos/clr-ios-strip-il-bodies-tests
Jul 9, 2026
Merged

[clr-ios] Disable R2R IL-body stripping for library tests that need IL at run time#130360
kotlarmilos merged 1 commit into
dotnet:mainfrom
kotlarmilos:dev/kotlarmilos/clr-ios-strip-il-bodies-tests

Conversation

@kotlarmilos

@kotlarmilos kotlarmilos commented Jul 8, 2026

Copy link
Copy Markdown
Member

Description

The Apple mobile CoreCLR library test apps are published as a composite ReadyToRun image with IL bodies stripped, which the SDK turns on by default for iOS-like runtime identifiers. A stripped body is replaced with an invalid stub, so any test that needs the real IL at run time fails. System.Runtime.Loader.Tests, System.Reflection.DispatchProxy.Tests, and System.Xml.XmlSerializer.ReflectionOnly.Tests load assemblies into collectible AssemblyLoadContext instances, which cannot use the R2R native code and recompile from IL, so they throw InvalidProgramException; System.Reflection.Metadata.Tests reads a stripped method body directly and throws BadImageFormatException.

The on-Helix AOT build reads only the properties forwarded through the _ApplePropertyNames allowlist in tests.ioslike.targets, so this change adds PublishReadyToRunStripILBodies to that allowlist and sets it to false on these four test projects, leaving stripping on for every other Apple mobile CoreCLR test app.

…L at run time

The Apple mobile CoreCLR library test apps are published as a composite ReadyToRun
image with IL bodies stripped, which the SDK turns on by default for iOS-like runtime
identifiers. A stripped body is replaced with an invalid stub, so any test that needs
the real IL at run time fails. System.Runtime.Loader.Tests,
System.Reflection.DispatchProxy.Tests and System.Xml.XmlSerializer.ReflectionOnly.Tests
load assemblies into collectible AssemblyLoadContext instances, which cannot use the
R2R native code and recompile from IL, so they throw InvalidProgramException.
System.Reflection.Metadata.Tests reads a stripped method body directly and throws
BadImageFormatException. Forward PublishReadyToRunStripILBodies through the
_ApplePropertyNames allowlist in tests.ioslike.targets and set it to false on these
four test projects, leaving stripping on for every other Apple mobile CoreCLR test app.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Apple mobile (“ioslike”) CoreCLR library test publish pipeline to preserve IL bodies for a small set of test projects that require IL at runtime, by explicitly disabling ReadyToRun IL-body stripping and ensuring that setting is forwarded through the Helix proxy-project property allowlist.

Changes:

  • Set PublishReadyToRunStripILBodies=false in four library test projects that need IL bodies at runtime.
  • Add PublishReadyToRunStripILBodies to the _ApplePropertyNames allowlist in eng/testing/tests.ioslike.targets so the Helix AOT/proxy build sees the project-level setting.
Show a summary per file
File Description
src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj Disables R2R IL-body stripping for this test project.
src/libraries/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj Disables R2R IL-body stripping for this test project.
src/libraries/System.Reflection.DispatchProxy/tests/System.Reflection.DispatchProxy.Tests.csproj Disables R2R IL-body stripping for this test project.
src/libraries/System.Private.Xml/tests/XmlSerializer/ReflectionOnly/System.Xml.XmlSerializer.ReflectionOnly.Tests.csproj Disables R2R IL-body stripping for this test project.
eng/testing/tests.ioslike.targets Allows PublishReadyToRunStripILBodies to flow into the Helix proxy project via _ApplePropertyNames.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 0

@kotlarmilos

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos

Copy link
Copy Markdown
Member Author

Tests pass on Apple mobile with no InvalidProgramException / NullReferenceException:

  • System.Reflection.DispatchProxy.Tests 
    - System.Runtime.Loader[.DefaultContext/.RefEmitLoadContext].Tests
    - System.Xml.XmlSerializer.ReflectionOnly.Tests
    - System.Reflection.Metadata.Tests 

@kotlarmilos kotlarmilos requested a review from jakobbotsch July 9, 2026 08:23
@kotlarmilos kotlarmilos requested a review from BrzVlad July 9, 2026 08:23
@kotlarmilos

Copy link
Copy Markdown
Member Author

/ba-g non-related extra platforms failures

@kotlarmilos kotlarmilos merged commit 75fa507 into dotnet:main Jul 9, 2026
204 of 220 checks passed
@dotnet dotnet deleted a comment from azure-pipelines Bot Jul 9, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot modified the milestones: 11.0.0, 11.0-preview7 Jul 10, 2026
kotlarmilos added a commit that referenced this pull request Jul 13, 2026
…eed IL at run time (#130468)

## Description

Follow-up to #130360. The SDK strips IL bodies from the Apple mobile
CoreCLR composite ReadyToRun image by default, replacing each body with
an invalid stub, so any test that needs the real IL at run time fails.
Three more projects hit this: `System.Runtime.Extensions.Tests`
(`AppDomainTests.ExecuteAssembly` invokes a stripped entry point,
`InvalidProgramException`), `System.IO.Hashing.Tests`
(`Crc64ParameterSet.ForwardCrc64.InitializeVectorized`, a `Vector128`
intrinsic fallback), and `System.Diagnostics.StackTrace.Tests` (the
runtime-async `V2Methods.Quuux` in `ToString_Async`). This sets
`PublishReadyToRunStripILBodies` to `false` on those three test
projects, which #130360 already forwards through the
`_ApplePropertyNames` allowlist, leaving stripping on for every other
Apple mobile CoreCLR test app.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants