Skip to content

Conversation

@jtschuster
Copy link
Member

Adds links for a number of expected warnings in test cases that aren't produced by all 3 tools.

Adds a reason string for IL3XXX warnings that are produced by both the analyzer and Native AOT.

@jtschuster jtschuster requested review from agocke, Copilot and sbomer June 18, 2025 23:12
@jtschuster jtschuster requested a review from marek-safar as a code owner June 18, 2025 23:12
@github-actions github-actions bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Jun 18, 2025
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Jun 18, 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 adds explicit reason strings (typically issue links or “NativeAOT-specific warning”) to ExpectedWarning/UnexpectedWarning attributes across many linker and analyzer test cases so that tools that don’t emit certain warnings can be better tracked and documented.

  • Added a GitHub issue URL for redundant suppression warnings (IL2121/IL2071) in trimmer tests.
  • Provided a “NativeAOT-specific warning” message for analyzer and Native AOT warnings (IL3002/IL3050).
  • Updated behavioral tests (UnexpectedWarning) in dataflow and exponential scenarios with issue links.

Reviewed Changes

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

File Description
src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypesUsingTarget.cs Added issue link reason to trimmer warnings
src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresWithCopyAssembly.cs Added “NativeAOT-specific warning” for method warnings
src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ExponentialDataFlow.cs Marked analyzer warning as unexpected with issue link
Comments suppressed due to low confidence (3)

src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresWithCopyAssembly.cs:45

  • [nitpick] The literal "NativeAOT-specific warning" is duplicated across many tests. Consider defining it as a shared const (e.g. const string NativeAotWarningReason) and reusing it to reduce duplication and typos.
		[ExpectedWarning ("IL3002", "--Method--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")]

src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypesUsingTarget.cs:40

  • [nitpick] The issue link is repeated in multiple attributes throughout these test files. Extract "https://github.com/dotnet/linker/issues/1971" into a shared constant (e.g. const string LinkerIssue1971) to improve maintainability.
		[ExpectedWarning ("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")]

src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ExponentialDataFlow.cs:103

  • [nitpick] The runtime issue URL is repeated in many test attributes here. Consider extracting "https://github.com/dotnet/runtime/issues/87596" into a constant or helper so future updates are easier.
			[ExpectedWarning ("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]

Copy link
Member

@sbomer sbomer left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@jtschuster jtschuster merged commit 344872c into dotnet:main Jul 2, 2025
70 of 76 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 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