Skip to content

[Foundation] Add [NullAllowed] to NSBundle members. Fixes #24803.#24805

Merged
rolfbjarne merged 1 commit intomainfrom
dev/rolf/nullability-nsbundle
Mar 3, 2026
Merged

[Foundation] Add [NullAllowed] to NSBundle members. Fixes #24803.#24805
rolfbjarne merged 1 commit intomainfrom
dev/rolf/nullability-nsbundle

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

Add missing [NullAllowed] attributes on return types and parameters
for Foundation.NSBundle members as reported by xtro-sharpie tests.
Remove the corresponding entries from the ignore files.

Fixes #24803.

Add missing [NullAllowed] attributes on return types and parameters
for Foundation.NSBundle members as reported by xtro-sharpie tests.
Remove the corresponding entries from the ignore files.

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

Fixes #24803.
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

Updates the Foundation NSBundle bindings to correctly reflect Apple SDK nullability contracts (particularly for resource lookup APIs), and aligns xtro-sharpie annotation expectations by removing now-unnecessary ignore entries.

Changes:

  • Added missing [NullAllowed] / [return: NullAllowed] annotations to multiple NSBundle properties and methods in src/foundation.cs (including GetUrlForResource overloads and several path/url helpers).
  • Updated NSBundle path/resource APIs to accept nullable name / fileExtension parameters where Apple headers allow nil.
  • Removed corresponding xtro-sharpie ignore entries now that the bindings match expected nullability.

Reviewed changes

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

Show a summary per file
File Description
src/foundation.cs Adds [NullAllowed] and [return: NullAllowed] to NSBundle members to match native nullability behavior/contracts.
tests/xtro-sharpie/api-annotations-dotnet/common-Foundation.ignore Removes NSBundle-related “missing-null-allowed” ignores that should now be resolved by the binding updates.
tests/xtro-sharpie/api-annotations-dotnet/macOS-AppKit.ignore Removes NSBundle AppKit-additions ignore entries now covered by new return nullability annotations.
tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore Drops the NSBundle.LoadNib(...) ignore entry now that the return is annotated nullable.
tests/xtro-sharpie/api-annotations-dotnet/tvOS-UIKit.ignore Drops the NSBundle.LoadNib(...) ignore entry now that the return is annotated nullable.
tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore Drops the NSBundle.LoadNib(...) ignore entry now that the return is annotated nullable.

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

✅ [CI Build #4bbbb0a] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 4bbbb0afdf48b540ffd50a98e3ec2149f9bbd622 [PR build]

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

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

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

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

✅ [CI Build #4bbbb0a] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 4bbbb0afdf48b540ffd50a98e3ec2149f9bbd622 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne enabled auto-merge (squash) March 3, 2026 08:52
@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🚀 [CI Build #4bbbb0a] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 156 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 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 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 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. [attempt 2] Html Report (VSDrops) Download

Pipeline on Agent
Hash: 4bbbb0afdf48b540ffd50a98e3ec2149f9bbd622 [PR build]

@rolfbjarne rolfbjarne merged commit 5ae1b92 into main Mar 3, 2026
52 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.

NSBundle.GetUrlForResource nullability does not match runtime behavior

4 participants