Skip to content

Implement TrimmingDescriptorNode for ILTrim XML descriptor support#126990

Open
Copilot wants to merge 1 commit intomainfrom
copilot/iltrim-implement-trimming-descriptor-node
Open

Implement TrimmingDescriptorNode for ILTrim XML descriptor support#126990
Copilot wants to merge 1 commit intomainfrom
copilot/iltrim-implement-trimming-descriptor-node

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

Description

The -x (XML descriptor) command-line option was unimplemented for ILTrim — the #if !ILTRIM block in Driver.cs simply skipped descriptor processing. This reuses TrimmingDescriptorNode from ILCompiler.Compiler to implement it.

Changes

  • Driver.cs (illink): Added TrimmingDescriptorNode using alias under #if ILTRIM; replaced the no-op #if !ILTRIM with inputs.Add(new TrimmingDescriptorNode(xmlFile))
  • TrimmingDescriptorNode.cs: Added #if ILTRIM to use factory.Logger/factory.Settings.FeatureSettings instead of MetadataManager; guarded ICompilationRootProvider with #if !ILTRIM (not available in ILTrim)
  • ILTrim.Core.csproj: Included TrimmingDescriptorNode.cs as a linked compile item
  • ILTrimExpectedFailures.txt: Removed 23 now-passing tests (mostly LinkXml.* and some Inheritance.Interfaces.*); added 1 new expected failure (LinkXml.UnusedNonRequiredTypeIsRemoved — inherits NativeAOT's DescriptorMarker semantics which don't honor required="0")

Test results: 0 failures, 308 passed (up from 285), 604 skipped.

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/d523a942-ceab-437f-850d-dcb3d528fd44

Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 16, 2026 08:48
Copilot AI review requested due to automatic review settings April 16, 2026 08:48
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Apr 16, 2026
@MichalStrehovsky MichalStrehovsky marked this pull request as ready for review April 16, 2026 08:50
Copilot AI review requested due to automatic review settings April 16, 2026 08:50
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

Implements support for ILTrim’s -x (XML descriptor) option by reusing the NativeAOT TrimmingDescriptorNode, enabling descriptor-based rooting during ILTrim runs and updating ILTrim test expectations accordingly.

Changes:

  • Enabled -x processing under ILTRIM by adding TrimmingDescriptorNode to ILTrim inputs instead of skipping descriptor handling.
  • Updated TrimmingDescriptorNode to compile and function under ILTRIM by using ILTrim’s NodeFactory logging/settings surface and excluding ICompilationRootProvider where unavailable.
  • Updated ILTrim expected failures list to reflect newly passing descriptor-related tests and added one expected failure due to semantic differences.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/tools/illink/src/linker/Linker/Driver.cs Wires -x into ILTrim by adding TrimmingDescriptorNode to ILTrim inputs.
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TrimmingDescriptorNode.cs Adds #if ILTRIM adaptations for logger/settings and guards ICompilationRootProvider.
src/coreclr/tools/ILTrim.Core/ILTrim.Core.csproj Links TrimmingDescriptorNode.cs into ILTrim.Core so ILTrim can use it.
src/coreclr/tools/ILTrim.Tests/ILTrimExpectedFailures.txt Removes now-passing tests from expected failures; adds one new expected failure.

@MichalStrehovsky MichalStrehovsky added area-Tools-ILLink .NET linker development as well as trimming analyzers and removed area-NativeAOT-coreclr labels Apr 16, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/illink
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

Labels

area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants