[dotnet-linker] Escape explicit interface member names - #26529
Conversation
Use documentation-comment escaping for explicit-interface properties and events when generating DynamicDependency attributes. This prevents first-build IL2037 warnings when the member name contains dots. Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/3057591. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a6097bb2-1e91-4dd7-ab9b-fa4a7ab070a0
There was a problem hiding this comment.
🟢 Approval recommended
The change is localized, aligns with existing signature-generation patterns, and includes a targeted regression test for the reported warning scenario.
Pull request overview
This PR updates the dotnet-linker’s DynamicDependency generation to correctly escape explicit-interface property and event member names (replacing . with #) so the trimmer doesn’t emit first-build IL2037 warnings when member names contain dots.
Changes:
- Extend
DocumentationComments.GetSignatureto supportPropertyDefinitionandEventDefinition, applying doc-comment escaping. - Update
AppBundleRewriterto use the escaped signatures for properties/events when generating per-memberDynamicDependencyAttributes. - Add a regression test ensuring explicit-interface property/event signatures are emitted escaped and contain no
..
File summaries
| File | Description |
|---|---|
| tools/dotnet-linker/DocumentionComments.cs | Adds signature helpers for properties/events and escapes explicit-interface member name dots. |
| tools/dotnet-linker/AppBundleRewriter.cs | Switches property/event DynamicDependency member signatures to use the escaping helper. |
| tests/assembly-preparer/ApplyPreserveAttributeTests.cs | Adds coverage verifying escaped signatures for explicit-interface properties/events. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #44dc8b5] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 264 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. [attempt 2] Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Use documentation-comment escaping for explicit-interface properties and events when generating DynamicDependency attributes. This prevents first-build IL2037 warnings when the member name contains dots.
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/3057591.
Copilot-Session: a6097bb2-1e91-4dd7-ab9b-fa4a7ab070a0