Skip to content

[CoreNFC] Add missing nullability on NSError parameters in callbacks. - #26531

Open
rolfbjarne wants to merge 6 commits into
dev/rolf/upgraded-potatofrom
dev/rolf/corenfc-delegate-nserror
Open

[CoreNFC] Add missing nullability on NSError parameters in callbacks.#26531
rolfbjarne wants to merge 6 commits into
dev/rolf/upgraded-potatofrom
dev/rolf/corenfc-delegate-nserror

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented Sep 2, 2026

Copy link
Copy Markdown
Member

Also a few nullability fixes in xtro to properly detect nullable types.

Fixes #21540.

Count both the array and its element type when walking NullableAttribute positions.

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

Copilot-Session: 1fdf7050-96ec-4575-91b8-12824be5644a
Non-generic value types do not consume positions in NullableAttribute byte arrays.

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

Copilot-Session: 1fdf7050-96ec-4575-91b8-12824be5644a
Copilot AI lite review requested due to automatic review settings September 2, 2026 10:30
@rolfbjarne rolfbjarne linked an issue Sep 2, 2026 that may be closed by this pull request

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.

🟡 Changes recommended

xtro-sharpie’s CountNullablePositions still miscounts generic value types due to branch ordering, which can produce incorrect nullability diagnostics.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates CoreNFC bindings to correctly surface nullable NSError parameters in completion callbacks (per Apple docs), and adjusts xtro-sharpie’s nullability accounting so it can correctly interpret nullable positions for arrays/value types when validating generated APIs.

Changes:

  • Enable nullable context in src/corenfc.cs and annotate NSError (and related callback parameters) as nullable where native APIs can pass nil.
  • Fix xtro-sharpie’s nullable-position counting for array types and value types.
  • Refresh xtro-sharpie ignore baselines by removing entries/files that are no longer expected after the analysis fix and binding updates.
File summaries
File Description
tests/xtro-sharpie/xtro-sharpie/NullabilityCheck.cs Updates nullable-position accounting (arrays/value types) used to validate block parameter nullability.
tests/xtro-sharpie/api-annotations-dotnet/macOS-HealthKit.ignore Removes a now-unneeded ignore entry after nullability-position accounting changes.
tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-HealthKit.ignore Removes a now-unneeded ignore entry after nullability-position accounting changes.
tests/xtro-sharpie/api-annotations-dotnet/iOS-HealthKit.ignore Removes a now-unneeded ignore entry after nullability-position accounting changes.
tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-CoreNFC.ignore Removes the ignore file now that CoreNFC callback nullability is corrected and/or diagnostics no longer apply.
tests/xtro-sharpie/api-annotations-dotnet/iOS-CoreNFC.ignore Removes now-unneeded CoreNFC nullability ignore entries.
tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-AppClip.ignore Removes the ignore file now that diagnostics no longer apply.
tests/xtro-sharpie/api-annotations-dotnet/iOS-AppClip.ignore Removes the ignore file now that diagnostics no longer apply.
tests/xtro-sharpie/api-annotations-dotnet/iOS-ARKit.ignore Removes the ignore file now that diagnostics no longer apply.
src/corenfc.cs Enables nullable context and fixes nullable NSError (and related) parameters in completion callbacks, including NFCQueryNdefStatusCompletionHandler.error.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/xtro-sharpie/xtro-sharpie/NullabilityCheck.cs
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Move the IsValueType check before GenericInstanceType handling in CountNullablePositions so generic value types (such as Nullable<T>) contribute zero nullable metadata positions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rolfbjarne rolfbjarne added ready-to-review This PR is ready to review/merge. and removed ready-to-review This PR is ready to review/merge. labels Sep 2, 2026
@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: 107084cc48579a85917b100948f54a0b89bba35d [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #107084c] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

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

Failures

❌ windows tests

🔥 Failed catastrophically on VSTS: test results - windows (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 7 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 31 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 31 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 25 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 25 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 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 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: 107084cc48579a85917b100948f54a0b89bba35d [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.

NFCQueryNdefStatusCompletionHandler.error nullability is wrong

3 participants