[mobile] Fix IL2007 in System.Runtime.Loader.Tests on non-iOS apple-mobile targets#128186
Closed
kotlarmilos wants to merge 1 commit into
Closed
[mobile] Fix IL2007 in System.Runtime.Loader.Tests on non-iOS apple-mobile targets#128186kotlarmilos wants to merge 1 commit into
kotlarmilos wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes IL2007 build errors in System.Runtime.Loader.Tests on Apple-mobile targets other than iOS/tvOS device (Mac Catalyst, iOS simulator, tvOS simulator) introduced by #127058. The shared ILLink.Descriptors.xml referenced System.Runtime.Loader.Test.Assembly{,2} as standalone assemblies, but those projects are only deployed as separate files on iOS/tvOS — elsewhere they are embedded resources, so ILLink cannot resolve them.
Changes:
- Remove the two iOS/tvOS-only entries from the shared
ILLink.Descriptors.xml. - Add a new
ILLink.Descriptors.AppleDevice.xmlcontaining those two entries. - Reference the new descriptor from the csproj only on
(ios|tvos) && EnableAggressiveTrimming && !UseNativeAotRuntime, matching theProjectReferencedeployment conditions.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Runtime.Loader/tests/ILLink.Descriptors.xml | Removes the two iOS/tvOS-only assembly entries that caused IL2007 elsewhere. |
| src/libraries/System.Runtime.Loader/tests/ILLink.Descriptors.AppleDevice.xml | New descriptor file preserving the two test assemblies under aggressive trimming on iOS/tvOS. |
| src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj | Conditionally includes the new descriptor for iOS/tvOS with aggressive trimming (non-NativeAOT). |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 0
0020f7c to
b0ebf03
Compare
…es to iOS/tvOS These two assemblies are only deployed as separate files on iOS/tvOS (see csproj ProjectReference conditions); on every other platform they are embedded resources of the main test assembly. Including their <assembly> entries in the shared ILLink.Descriptors.xml caused ILLink to fail with IL2007: 'Could not resolve assembly' on maccatalyst, iossimulator, and any other target with aggressive trimming. Move them to a sibling AppleDevice descriptor that is only included when ProjectReference matches. Regression from dotnet#127058 (commit d101f76). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b0ebf03 to
e15ac96
Compare
This was referenced May 14, 2026
Open
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.
Note
This PR description was drafted with assistance from GitHub Copilot.
Description
Fixes IL2007 build failure in
System.Runtime.Loader.Testson every Apple-mobile target except iOS/tvOS device:Reproduces in
runtime-extra-platformslegsBuild maccatalyst-arm64 Release AllSubsets_CoreCLR,maccatalyst-x64 Release AllSubsets_CoreCLR,iossimulator-arm64/x64 Release AllSubsets_CoreCLR,tvos-arm64 Release AllSubsets_CoreCLR_RuntimeTests. First reproduction onmain: build 1403076 (commit8f854afd60, Apr 30); the build immediately before — 1401195 (9a6034a3ea) — was clean.Cause
#127058 added two
<assembly>entries to the sharedILLink.Descriptors.xml:But the corresponding
ProjectReferenceinSystem.Runtime.Loader.Tests.csprojonly deploys those two assemblies as separate files on iOS/tvOS:On every other platform they are embedded resources, so ILLink can't resolve them as standalone assemblies and fails with IL2007 whenever the descriptor is included (i.e. with aggressive trimming).
Fix
Split the two iOS/tvOS-only entries into a sibling
ILLink.Descriptors.AppleDevice.xmland<TrimmerRootDescriptor>it only on(TargetOS == 'ios' or TargetOS == 'tvos') && EnableAggressiveTrimming && !UseNativeAotRuntime.