Skip to content

[Foundation] Improve NSArray.StringArrayFromHandle a bit.#24640

Merged
rolfbjarne merged 2 commits intomainfrom
dev/rolf/foundation-nullability-44-nsarray-stringarrayfromhandle
Feb 6, 2026
Merged

[Foundation] Improve NSArray.StringArrayFromHandle a bit.#24640
rolfbjarne merged 2 commits intomainfrom
dev/rolf/foundation-nullability-44-nsarray-stringarrayfromhandle

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

  • Enable nullability.
  • Call the equivalent CFArray.StringArrayFromHandle to reuse existing (and faster) code.
  • Since a better alternative exists (CFArray.StringArrayFromHandle), remove this method in XAMCORE_5_0.

Contributes towards #17285.

* Enable nullability.
* Call the equivalent CFArray.StringArrayFromHandle to reuse existing (and faster) code.
* Since a better alternative exists (CFArray.StringArrayFromHandle), remove this method in XAMCORE_5_0.

Contributes towards #17285.
@rolfbjarne rolfbjarne requested a review from Copilot February 6, 2026 07:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 improves the NSArray.StringArrayFromHandle method by enabling nullability, improving performance by delegating to CFArray.StringArrayFromHandle, and scheduling its removal in XAMCORE_5_0. This contributes to the broader effort tracked in issue #17285 to add nullability to Foundation base types.

Changes:

  • Enabled nullability for NSArray.StringArrayFromHandle with proper nullable annotations (string? []?)
  • Delegated implementation to CFArray.StringArrayFromHandle for better performance
  • Wrapped method in #if !XAMCORE_5_0 to schedule removal in version 5.0
  • Updated RegistrarHelper.NSArray_string_native_to_managed signature to match new nullability annotations

Reviewed changes

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

File Description
src/Foundation/NSArray.cs Enabled nullability for StringArrayFromHandle, delegated to CFArray implementation, improved documentation, and scheduled removal in XAMCORE_5_0
src/ObjCRuntime/RegistrarHelper.cs Updated parameter signature from string []? to string? []? to reflect that array elements can be nullable

@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

✅ [PR Build #7f685d9] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 7f685d9bb02f052c37b10108ff8e7a278cda2bf3 [PR build]

@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: 7f685d9bb02f052c37b10108ff8e7a278cda2bf3 [PR build]

@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

This comment has been minimized.

@rolfbjarne rolfbjarne enabled auto-merge (squash) February 6, 2026 11:29
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #7f685d9] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 7f685d9bb02f052c37b10108ff8e7a278cda2bf3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [CI Build #7f685d9] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 7f685d9bb02f052c37b10108ff8e7a278cda2bf3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #7f685d9] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 7f685d9bb02f052c37b10108ff8e7a278cda2bf3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #7f685d9] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 7f685d9bb02f052c37b10108ff8e7a278cda2bf3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #7f685d9] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 7f685d9bb02f052c37b10108ff8e7a278cda2bf3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #7f685d9] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 7f685d9bb02f052c37b10108ff8e7a278cda2bf3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

💻 [CI Build #7f685d9] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: 7f685d9bb02f052c37b10108ff8e7a278cda2bf3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🚀 [CI Build #7f685d9] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 117 tests passed 🎉

Tests counts

✅ 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: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 9 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 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

Pipeline on Agent
Hash: 7f685d9bb02f052c37b10108ff8e7a278cda2bf3 [PR build]

@rolfbjarne rolfbjarne merged commit 35a8187 into main Feb 6, 2026
47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants