Skip to content

Fix trimmed library test assemblies missing from app bundles on tvOS#126988

Open
kotlarmilos wants to merge 1 commit intodotnet:mainfrom
kotlarmilos:fix/tvos-trimming-root-assembly
Open

Fix trimmed library test assemblies missing from app bundles on tvOS#126988
kotlarmilos wants to merge 1 commit intodotnet:mainfrom
kotlarmilos:fix/tvos-trimming-root-assembly

Conversation

@kotlarmilos
Copy link
Copy Markdown
Member

@kotlarmilos kotlarmilos commented Apr 16, 2026

Summary

PR #125673 changed Microsoft.NET.ILLink.targets to skip creating the TrimmerRootAssembly item for Library-output projects. The RootEntireIntermediateAssembly target in eng/testing/tests.mobile.targets relied on that item existing so it could update its RootMode metadata from EntryPoint to all.

Since the item no longer exists for Library projects, the metadata update is a no-op and the test assembly is left unrooted. ILLink trims it entirely, causing all Release library tests on tvOS (both CoreCLR and Mono) to fail with:

Test libs were not found (*.Tests.dll was not found in .../AppBundle/...)

Fix

Change RootEntireIntermediateAssembly to use Remove+Include instead of metadata update, so the item is unconditionally created with RootMode=all regardless of whether the SDK already created one.

cc @sbomer

PR dotnet#125673 changed Microsoft.NET.ILLink.targets to skip creating the
TrimmerRootAssembly item for Library-output projects. The
RootEntireIntermediateAssembly target in tests.mobile.targets relied on
that item existing so it could update its RootMode metadata from
EntryPoint to 'all'. Since the item no longer exists for Library
projects, the metadata update is a no-op and the test assembly is left
unrooted. ILLink then trims it entirely, causing all Release library
tests on tvOS (both CoreCLR and Mono) to fail with:
  'Test libs were not found (*.Tests.dll was not found in ...)'

Fix by using Remove+Include to unconditionally create the
TrimmerRootAssembly item with RootMode='all', regardless of whether
the SDK already created one.

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

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

@kotlarmilos kotlarmilos added this to the 11.0.0 milestone Apr 16, 2026
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

Fixes tvOS Release library test app bundles losing trimmed test assemblies by ensuring the test project’s intermediate assembly is always rooted for ILLink when the project output is not an executable.

Changes:

  • Update RootEntireIntermediateAssembly to unconditionally (re)create the TrimmerRootAssembly item with RootMode=all via Remove+Include.
  • Adjust the surrounding comment to explain why the SDK no longer provides the item for OutputType=Library.

Comment thread eng/testing/tests.mobile.targets
@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).

The SDK settings root only the entry point by default. These targets are used not only for standard
console apps, but also for test projects without an entry point. -->
The SDK no longer creates a TrimmerRootAssembly item for Library projects (see
Microsoft.NET.ILLink.targets), so update the metadata if the item exists and
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: the comment seems inaccurate since this is removing the update

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.

3 participants