Skip to content

Conversation

@sbomer
Copy link
Member

@sbomer sbomer commented Jul 9, 2025

Cleans up some of the validation logic for compiler-generated code.
This makes the logic more uniform for types/fields/methods/properties/events.
Also makes the logic more consistent between ILLink and ILC.

This will be useful to make the skip-validation logic more flexible in the future,
which will be useful for another feature I'm working on.

For compiler-generated code.
This makes the logic more uniform for types/fields/methods/properties/events.

Also makes the logic more consistent between
ILLink and ILC.
@sbomer sbomer requested review from a team and Copilot July 9, 2025 00:11
@sbomer sbomer requested a review from marek-safar as a code owner July 9, 2025 00:11
@github-actions github-actions bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Jul 9, 2025
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Jul 9, 2025
@dotnet-policy-service
Copy link
Contributor

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

Copy link
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 standardizes how compiler-generated members are handled during kept-items validation by introducing a SkipKeptItemsValidation helper and replacing ad-hoc checks across ILLink and ILC test runners.

  • Introduces SkipKeptItemsValidation(IMemberDefinition) to encapsulate compiler-generated skipping logic.
  • Refactors verification methods to take a skipKeptItemsValidation flag instead of a compilerGenerated boolean.
  • Applies the new approach consistently across ILLink and ILC test assemblies.

Reviewed Changes

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

File Description
src/tools/illink/test/Trimming.Tests.Shared/AssemblyChecker.cs Replaced top-level IsCompilerGeneratedMemberName with SkipKeptItemsValidation and nested helper
src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs Swapped IsCompilerGeneratedMember checks for SkipKeptItemsValidation and added using System.Diagnostics;
src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/AssemblyChecker.cs Propagated skipKeptItemsValidation flag through various verification methods
Comments suppressed due to low confidence (2)

src/tools/illink/test/Trimming.Tests.Shared/AssemblyChecker.cs:41

  • The local function IsCompilerGeneratedMemberName is defined inside SkipKeptItemsValidation but never used, and the original top-level helper was removed. This causes calls in IsCompilerGeneratedMember to reference an undefined symbol. Consider moving or restoring IsCompilerGeneratedMemberName to the appropriate scope.
            static bool IsCompilerGeneratedMemberName(string memberName)

src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs:6

  • The System.Diagnostics namespace is imported but not used in this file. You can remove this using directive to clean up unused dependencies.
using System.Diagnostics;

@sbomer sbomer merged commit 3f18473 into dotnet:main Jul 9, 2025
111 of 117 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

2 participants