Skip to content

[Foundation] Improve NSObject_Disposer a bit. - #26361

Open
rolfbjarne wants to merge 4 commits into
mainfrom
dev/rolf/disposer
Open

[Foundation] Improve NSObject_Disposer a bit.#26361
rolfbjarne wants to merge 4 commits into
mainfrom
dev/rolf/disposer

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented Jul 30, 2026

Copy link
Copy Markdown
Member
  • Remove unnecessary accesibility modifier ('private').
  • Remove the unused 'drainHandle' field.
  • Replace the all-encompassing [Preserve] attribute with a targeted [DynamicDependency] attribute. This results in rather drastic size savings for NativeAOT apps (300-500kb/up to 10% smaller, depending on platform).

* Remove unnecessary accesibility modifier ('private').
* Remove the unused 'drainHandle' field.
* Remove the [Preserve] attribute, it's no longer needed.
Copilot AI review requested due to automatic review settings July 30, 2026 09:53

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

This PR aims to simplify the NSObject_Disposer helper inside Foundation.NSObject by removing unused/internal-only constructs, reducing clutter in the core Foundation runtime bindings.

Changes:

  • Removes the [Preserve (AllMembers = true)] attribute from the __NSObject_Disposer helper type.
  • Removes the unused drainHandle field (MONOMAC-only).
  • Removes the explicit private accessibility modifier from the NSObject_Disposer constructor (keeps it non-instantiable).

Comment thread src/Foundation/NSObject2.cs
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

⚠️ AppSizeTest expected files changed ⚠️

The AppSizeTest detected changes in the expected app size files.

To update the expected files, add a comment with the following command:

/apply-gist https://gist.github.com/vs-mobiletools-engineering-service2/ea48e6363892c6bebc53719cb3da3ed3
Updated files
  • iOS-MonoVM-interpreter-preservedapis.txt
  • iOS-MonoVM-preservedapis.txt
  • iOS-NativeAOT-size.txt
  • iOS-NativeAOT-TrimmableStatic-size.txt
  • MacCatalyst-MonoVM-interpreter-preservedapis.txt
  • MacCatalyst-MonoVM-preservedapis.txt
  • MacCatalyst-NativeAOT-size.txt
  • MacCatalyst-NativeAOT-TrimmableStatic-size.txt
  • MacOSX-NativeAOT-size.txt
  • MacOSX-NativeAOT-TrimmableStatic-size.txt
  • TVOS-MonoVM-interpreter-preservedapis.txt
  • TVOS-MonoVM-preservedapis.txt
  • TVOS-NativeAOT-size.txt
  • TVOS-NativeAOT-TrimmableStatic-size.txt

Pipeline on Agent
Hash: 446b5994d63964b831f7456a1030b32fd0369c66 [PR build]

@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner July 30, 2026 15:59
@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: af3198ccac08cb7f28913e7b7421a710b936fac3 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne
rolfbjarne enabled auto-merge (squash) July 31, 2026 13:28
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #af3198c] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

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

Failures

❌ Tests on macOS Sonoma (14) tests

🔥 Failed catastrophically on VSTS: test results - mac_sonoma (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
✅ 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 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: af3198ccac08cb7f28913e7b7421a710b936fac3 [PR build]

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