Skip to content

[linker] Remove Foundation member attributes - #26257

Merged
rolfbjarne merged 1 commit into
mainfrom
dev/rolf/remove-foundation-member-attributes
Jul 28, 2026
Merged

[linker] Remove Foundation member attributes#26257
rolfbjarne merged 1 commit into
mainfrom
dev/rolf/remove-foundation-member-attributes

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

Remove Foundation.RequiredMemberAttribute and Foundation.OptionalMemberAttribute instances unconditionally using the platform assembly's embedded ILLink descriptor.

Add linked-output metadata coverage that verifies both Foundation attributes are removed while System.Runtime.CompilerServices.RequiredMemberAttribute remains unaffected.

🤖 Pull request created by Copilot

Remove Foundation.RequiredMemberAttribute and Foundation.OptionalMemberAttribute instances through the platform assembly's embedded ILLink descriptor. Add linked-output metadata coverage that keeps the BCL RequiredMemberAttribute as an exact-name control.

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

Copilot-Session: 64f1816e-0169-4a01-9ab2-f482fb13fc87
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

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

Removes Foundation.RequiredMemberAttribute and Foundation.OptionalMemberAttribute custom-attribute instances during trimming by extending the platform assembly’s embedded ILLink descriptor, and adds a linked-output unit test to ensure those Foundation attributes are stripped while the compiler’s System.Runtime.CompilerServices.RequiredMemberAttribute remains.

Changes:

  • Updated the embedded linker descriptor to remove instances of the two Foundation “member” attributes.
  • Added a small iOS test app that applies [Foundation.RequiredMember] / [Foundation.OptionalMember] and also uses a C# required property.
  • Added a PublishTrimmedTest that builds the app with full linking and uses Cecil to verify expected attribute removal/preservation in the linked outputs.

Reviewed changes

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

File Description
tests/dotnet/UnitTests/PublishTrimmedTest.cs Adds a new trim/link validation test that inspects linked assemblies for removed/preserved attribute instances.
tests/dotnet/LinkerAttributesTestApp/LinkerAttributesTestApp.csproj Introduces a minimal iOS test project used by the new trimming test.
tests/dotnet/LinkerAttributesTestApp/AppDelegate.cs Adds code that emits both Foundation member attributes and the compiler-required-member attribute for verification post-link.
src/ILLink.LinkAttributes.xml.in Extends the embedded ILLink descriptor to remove instances of Foundation.OptionalMemberAttribute and Foundation.RequiredMemberAttribute.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne
rolfbjarne marked this pull request as ready for review July 27, 2026 18:11
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: a34913226a94654f5ad903731980af9fe400cd85 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Jul 28, 2026
@rolfbjarne
rolfbjarne enabled auto-merge (squash) July 28, 2026 10:12
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #a349132] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 203 tests passed 🎉

Tests counts

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 19 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: a34913226a94654f5ad903731980af9fe400cd85 [PR build]

@rolfbjarne
rolfbjarne merged commit 83a159c into main Jul 28, 2026
57 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/remove-foundation-member-attributes branch July 28, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants