Revert "Simplify TrimmerSingleWarn intermediate assembly update using MSBuild item Update"#127656
Revert "Simplify TrimmerSingleWarn intermediate assembly update using MSBuild item Update"#127656
Conversation
… MSBuild…" This reverts commit a8f6705.
|
Tagging subscribers to this area: @agocke, @dotnet/illink |
There was a problem hiding this comment.
Pull request overview
Reverts the prior simplification that used MSBuild item Update in _PrepareTrimConfiguration, restoring a set-based approach to ensure TrimmerSingleWarn=false metadata is correctly applied to the ResolvedFileToPublish item(s) corresponding to @(IntermediateAssembly).
Changes:
- Replace the
ResolvedFileToPublish Update="@(IntermediateAssembly)"metadata update with explicit include/remove set operations to compute the intersection between@(ResolvedFileToPublish)and@(IntermediateAssembly). - Re-add the updated intersection items back into
@(ResolvedFileToPublish)so downstream consumers observe the metadata.
Show a summary per file
| File | Description |
|---|---|
src/tools/illink/src/ILLink.Tasks/build/Microsoft.NET.ILLink.targets |
Restores reliable MSBuild item manipulation to apply TrimmerSingleWarn metadata to the intermediate assembly’s publish items without using Update in a target. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
🤖 Copilot Code Review — PR #127656Note This review was generated by GitHub Copilot. Holistic AssessmentMotivation: This PR reverts PR #125630 which simplified the Approach: A clean Summary: ✅ LGTM. This is a clean revert that restores known-working logic. The set-intersection pattern is correct and well-commented. One optional suggestion for preventing future re-simplification attempts. Detailed Findings✅ Clean Revert — Verified correctThe revert is clean and focused. Only the expected file is modified, and the restored code exactly matches the pre-simplification state. No unrelated changes or scope creep. ✅ Restored MSBuild Logic — Verified correctThe set-intersection pattern is mathematically sound:
This correctly limits 💡 Suggestion — Add preventive comment (follow-up, not blocking)Future maintainers may attempt to "simplify" this code again. Consider adding a comment explaining why the simpler <!-- NOTE: Cannot use <ResolvedFileToPublish Update="@(IntermediateAssembly)"> because
Update inside targets has a bug (dotnet/msbuild#2835) that updates ALL items
instead of only matching ones. Use set operations instead. -->This was flagged independently by multiple review models (Claude Sonnet 4.5, GPT-5.3-Codex). Review contributed by: Claude Opus 4.6 (primary), Claude Sonnet 4.5, GPT-5.3-Codex
|
|
/backport to release/11.0-preview4 |
|
Started backporting to |
Reverts #125630
The
Updatein a target doesn't work (see dotnet/msbuild#2835 for the MSBuild behavior).Fixes the dependency flow issue here: dotnet/sdk#53847 (comment).