Skip to content

System.Runtime.Loader.Tests: use TargetsAppleMobile for test-assembly references to unblock trimmed simulator/macCatalyst builds#128135

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-build-errors-apple-platforms
Open

System.Runtime.Loader.Tests: use TargetsAppleMobile for test-assembly references to unblock trimmed simulator/macCatalyst builds#128135
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-build-errors-apple-platforms

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 13, 2026

System.Runtime.Loader.Tests was failing on Apple mobile simulator/macCatalyst CoreCLR legs because ILLink could not resolve System.Runtime.Loader.Test.Assembly* during aggressive trimming. The project reference conditions only treated ios/tvos as mobile, leaving simulator/macCatalyst in the embedded-resource path.

  • Scope

    • Update src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj only.
    • No test code changes, no descriptor changes.
  • Change

    • Replace TargetOS == ios/tvos gating for the two loader test assemblies with TargetsAppleMobile.
    • Resulting behavior:
      • TargetsAppleMobile == true: direct ProjectReference (assembly available to trimmer)
      • otherwise: keep existing embedded-resource behavior (ReferenceOutputAssembly="false", OutputItemType="EmbeddedResource")
  • Why this resolves the failure

    • Simulator and macCatalyst now follow the same mobile reference mode as iOS/tvOS device builds, so ILLink sees System.Runtime.Loader.Test.Assembly and System.Runtime.Loader.Test.Assembly2 as resolvable inputs.
<ProjectReference Condition="'$(TargetsAppleMobile)' == 'true'"
                  Include="System.Runtime.Loader.Test.Assembly\System.Runtime.Loader.Test.Assembly.csproj" />
<ProjectReference Condition="'$(TargetsAppleMobile)' == 'true'"
                  Include="System.Runtime.Loader.Test.Assembly2\System.Runtime.Loader.Test.Assembly2.csproj" />

Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 13, 2026 12:34
Copilot AI changed the title [WIP] Fix build errors for System.Runtime.Loader.Tests on Apple mobile platforms System.Runtime.Loader.Tests: use TargetsAppleMobile for test-assembly references to unblock trimmed simulator/macCatalyst builds May 13, 2026
Copilot AI requested a review from kotlarmilos May 13, 2026 12:35
@github-actions github-actions Bot added the area-AssemblyLoader-coreclr only use for closed issues label May 13, 2026
@kotlarmilos kotlarmilos marked this pull request as ready for review May 13, 2026 12:49
Copilot AI review requested due to automatic review settings May 13, 2026 12:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 adjusts System.Runtime.Loader.Tests project reference conditions so Apple mobile targets consistently use direct ProjectReferences (instead of embedding the referenced test assemblies as resources), aligning the behavior across iOS/tvOS, simulators, and MacCatalyst.

Changes:

  • Switch conditional logic from $(TargetOS) == ios/tvos to $(TargetsAppleMobile) for System.Runtime.Loader.Test.Assembly and System.Runtime.Loader.Test.Assembly2.
  • Keep the existing non-Apple-mobile behavior of embedding those referenced assemblies as resources (ReferenceOutputAssembly="false", OutputItemType="EmbeddedResource").
  • Update the inline comment to reflect the Apple-mobile-specific restriction.
Show a summary per file
File Description
src/libraries/System.Runtime.Loader/tests/System.Runtime.Loader.Tests.csproj Uses TargetsAppleMobile to decide between direct references (Apple mobile) vs embedded resources (other targets) for two loader test assemblies.

Copilot's findings

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

@kotlarmilos kotlarmilos enabled auto-merge (squash) May 13, 2026 15:03
@teo-tsirpanis teo-tsirpanis added area-AssemblyLoader and removed area-AssemblyLoader-coreclr only use for closed issues labels May 13, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @elinor-fung
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.Runtime.Loader.Tests fails to build on Apple mobile platforms with IL2007 assembly resolution errors

5 participants