Skip to content

Fix nested type forwarder preservation#131331

Merged
sbomer merged 2 commits into
dotnet:mainfrom
sbomer:runtime-concurrenttest
Jul 25, 2026
Merged

Fix nested type forwarder preservation#131331
sbomer merged 2 commits into
dotnet:mainfrom
sbomer:runtime-concurrenttest

Conversation

@sbomer

@sbomer sbomer commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

  • record every simple type resolved from a type-name string so declaring and nested exported-type chains are retained
  • add generic and non-generic nested forwarder regression coverage
  • re-enable the ConcurrentDictionary test on aggressively trimmed platforms

Fixes #81945

Testing

  • Mono.Linker.Tests.TestCases.All.TypeForwardingTests
  • Mono.Linker.Tests.TestCases.All.ReflectionTests
  • ConcurrentDictionary_Generic_Tests_string_string.NonRandomizedToRandomizedUpgrade_FunctionsCorrectly
  • fully trimmed publish reproducer using the locally built linker

Note

This pull request was created with assistance from GitHub Copilot.

Record every simple type resolved from a type name so ILLink retains declaring and nested exported type chains. Add generic and non-generic regression coverage and re-enable the ConcurrentDictionary trimming test.

Assisted-by: GitHub Copilot CLI:gpt-5.6-sol

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

Copilot-Session: 20feb2ad-cfe6-49f7-8048-55e1c5ad425a
Copilot AI review requested due to automatic review settings July 24, 2026 16:49
@github-actions github-actions Bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Jul 24, 2026
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Jul 24, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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

Updates the ILLink type-name resolution bookkeeping so that nested-type resolution from string literals can preserve the full exported-type / forwarder chain, adds regression coverage for nested forwarders (including generic), and re-enables a previously skipped ConcurrentDictionary trimming scenario test.

Changes:

  • Update TypeNameResolver to record simple type resolutions during nested-type parsing.
  • Add a new linker test case that exercises nested forwarded types via Type.GetType, and extend the dependency library with a generic nested type.
  • Re-enable ConcurrentDictionary_Generic_Tests_string_string.NonRandomizedToRandomizedUpgrade_FunctionsCorrectly by removing ActiveIssue gating.
Show a summary per file
File Description
src/tools/illink/test/Mono.Linker.Tests.Cases/TypeForwarding/NestedTypeForwarderUsedViaReflection.cs New regression coverage for nested (generic + non-generic) forwarded types resolved via Type.GetType strings.
src/tools/illink/test/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwardedNestedTypeLibrary.cs Adds a forwarded generic nested type and forwards it in the forwarder assembly build.
src/tools/illink/src/linker/Linker/TypeNameResolver.cs Moves/expands type-resolution recording to include nested resolution segments.
src/libraries/System.Collections.Concurrent/tests/ConcurrentDictionary/ConcurrentDictionary.Generic.Tests.cs Removes ActiveIssue attributes to re-enable the previously skipped test on trimmed / mobile platforms.

Copilot's findings

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

Comment thread src/tools/illink/src/linker/Linker/TypeNameResolver.cs
Assisted-by: GitHub Copilot:gpt-5.6-sol

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

Copilot-Session: 20feb2ad-cfe6-49f7-8048-55e1c5ad425a
Copilot AI review requested due to automatic review settings July 24, 2026 18:37

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.

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 0 new

@sbomer
sbomer requested a review from a team July 24, 2026 18:46

@jtschuster jtschuster left a comment

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.

Thank you!

@sbomer
sbomer merged commit 8f65ed7 into dotnet:main Jul 25, 2026
149 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Jul 25, 2026
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

Status: Done

3 participants