Skip to content

[Foundation] Improve NSArray.FromStrings a bit.#24583

Merged
rolfbjarne merged 7 commits intomainfrom
dev/rolf/foundation-nullability-44-nsarray-fromstrings
Feb 3, 2026
Merged

[Foundation] Improve NSArray.FromStrings a bit.#24583
rolfbjarne merged 7 commits intomainfrom
dev/rolf/foundation-nullability-44-nsarray-fromstrings

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

  • Enable nullability.
  • Reuse existing code to create the native array.
  • Add tests.
  • Add xml docs.
  • Update nullability in some of the consumers of these methods whenever it makes sense.
  • Adjust CFArray.Create|FromStrings methods to match NSArray's equivalent methods.

Contributes towards #17285.

* Enable nullability.
* Reuse existing code to create the native array.
* Add tests.
* Add xml docs.
* Update nullability in some of the consumers of these methods whenever it makes sense.
* Adjust CFArray.Create|FromStrings methods to match NSArray's equivalent methods.

Contributes towards #17285.
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.FromStrings methods and related CFArray methods by enabling nullability, adding better XML documentation, improving the implementation to reuse existing code, and adding comprehensive tests.

Changes:

  • Enabled nullability in NSArray.FromStrings and added a new FromNullableStrings method for nullable array inputs
  • Refactored NSArray.FromStrings to reuse CFArray.Create, eliminating duplicated marshaling logic
  • Updated CFArray.Create and FromStrings to accept nullable strings with proper documentation
  • Updated consumers (NSSet, NSOrderedSet, NSMutableSet) to accept nullable string arrays
  • Added comprehensive tests for both NSArray and CFArray with null items

Reviewed changes

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

Show a summary per file
File Description
src/Foundation/NSArray.cs Refactored FromStrings to delegate to CFArray.Create, added FromNullableStrings method, improved XML docs, enabled nullability
src/CoreFoundation/CFArray.cs Enhanced Create method with IReadOnlyList overload, updated FromStrings signature, added XML documentation
tests/monotouch-test/Foundation/ArrayTest.cs Added tests for FromStrings with null items, IReadOnlyList, and FromNullableStrings
tests/monotouch-test/CoreFoundation/ArrayTest.cs Added tests for Create and FromStrings with null items and IReadOnlyList
src/bgen/Generator.cs Updated generator to use FromNullableStrings for nullable string arrays
src/Foundation/NSSet.cs Updated constructor to accept nullable string arrays
src/Foundation/NSOrderedSet.cs Updated constructors to accept nullable string arrays
src/Foundation/NSMutableSet.cs Updated constructor to accept nullable string arrays
src/CoreText/CTFont.cs Updated GetDefaultCascadeList to use FromNullableStrings
src/CoreServices/FSEvents.cs Fixed logic to properly check for null before checking Count

@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.

@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.

@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.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne marked this pull request as ready for review January 31, 2026 01:06
@rolfbjarne rolfbjarne enabled auto-merge (squash) January 31, 2026 01:07
@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.

@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

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

Pipeline on Agent
Hash: e219eadb89f4059a4a39243459d3c98d7e377614 [PR build]

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

✅ [CI Build #e219ead] Build passed (Build packages) ✅

Pipeline on Agent
Hash: e219eadb89f4059a4a39243459d3c98d7e377614 [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: e219eadb89f4059a4a39243459d3c98d7e377614 [PR build]

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

✅ [CI Build #e219ead] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: e219eadb89f4059a4a39243459d3c98d7e377614 [PR build]

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

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

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

Pipeline on Agent
Hash: e219eadb89f4059a4a39243459d3c98d7e377614 [PR build]

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

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

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

Pipeline on Agent
Hash: e219eadb89f4059a4a39243459d3c98d7e377614 [PR build]

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

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

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

Pipeline on Agent
Hash: e219eadb89f4059a4a39243459d3c98d7e377614 [PR build]

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

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

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

Pipeline on Agent
Hash: e219eadb89f4059a4a39243459d3c98d7e377614 [PR build]

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

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

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

Pipeline on Agent
Hash: e219eadb89f4059a4a39243459d3c98d7e377614 [PR build]

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

🚀 [CI Build #e219ead] 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: e219eadb89f4059a4a39243459d3c98d7e377614 [PR build]

@rolfbjarne rolfbjarne merged commit a4585b3 into main Feb 3, 2026
47 checks passed
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.

4 participants