Skip to content

[linker] Remove Foundation member attributes#26257

Draft
rolfbjarne wants to merge 1 commit into
mainfrom
dev/rolf/remove-foundation-member-attributes
Draft

[linker] Remove Foundation member attributes#26257
rolfbjarne wants to merge 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

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

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #a349132] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

1 tests crashed, 1 tests failed, 198 tests passed.

Failures

❌ windows tests

1 tests failed, 2 tests passed.

Failed tests

  • Remote .NET tests/Xamarin.Tests.DotNetProjectTest.AppWithLibraryWithResourcesReferenceOnRemoteWindows(iOS,"ios-arm64",False): Failed: 'dotnet build' failed with exit code 1

Html Report (VSDrops) Download

❌ xcframework tests

🔥 Failed catastrophically on VSTS: test results - xcframework (no summary found).

Html Report (VSDrops) Download

Successes

✅ 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. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 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. 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]

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants