Skip to content

[GameKit] Fix GKTurnBasedMatch decline invite callback binding - #26813

Merged
rolfbjarne merged 18 commits into
mainfrom
dev/rolf/fix-declineinvite-binding
Dec 2, 2026
Merged

rolfbjarne merged 18 commits into
mainfrom
dev/rolf/fix-declineinvite-binding

Conversation

@rolfbjarne

@rolfbjarne rolfbjarne commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Apple's GKTurnBasedMatch.declineInviteWithCompletionHandler: invokes its completion block with only a nullable NSError. The existing binding incorrectly expects both a match and an error, so invoking the callback can use the wrong native block signature.

Bind the native selector to Action<NSError?> and expose DeclineInviteWithError / DeclineInviteWithErrorAsync. Preserve the existing virtual two-argument DeclineInvite and DeclineInviteAsync signatures for source and binary compatibility by forwarding through the corrected binding; the legacy match argument is null. Under XAMCORE_5_0, the corrected signature takes the DeclineInvite name. Remove the obsolete xtro suppression.

🤖 Pull request created by Copilot

rolfbjarne and others added 13 commits September 25, 2026 18:22
Compile the repository's API-definition and binding-attribute assemblies with full nullable context, matching the already-enabled core and platform assemblies. Restore the inherited context after Foundation's locally annotated callback and remove an obsolete HealthKit warning suppression.

Enable annotations in both bgen's fallback compilation and the binding-project MSBuild target without imposing new nullable warnings on consuming projects. This covers direct csc response files and the separate binding-tool routes while keeping generated bindings buildable across all four platforms.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Put -nullable+ in DOTNET_FLAGS so core, platform, API-definition, and binding-attribute compiler invocations use the same setting. Remove redundant switches from the core and platform response files and the attribute-library command; keep it in the API-definition response files because they are separately consumed by generated analysis projects.

Track changes to Makefile when deciding whether to rebuild the binding-attribute assembly, so a future change to shared compiler flags also recompiles that direct-csc output.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Document ten active Network enums and all 42 of their values, with one commit for each type. Remove the corresponding 42 Cecil documentation known-failure entries.

🤖 Pull request created by Copilot

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Annotate both view controller and error as nullable in the local player's authentication handler for iOS, Mac Catalyst, tvOS, and macOS. Keep the existing nullable handler contract while the file is not yet nullable-enabled.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Match the nullable result and error parameters declared by GameKit's SDK headers across its completion callbacks. Keep enum and value-type arguments nonnullable, and annotate the optional best-host responses as nullable.

With PR #26746 enabling nullable annotations in API definitions globally, these annotations flow through bgen without local nullable directives.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove the now-obsolete missing-null-allowed entries for GameKit callbacks and the local-player authentication handler. The managed annotations now match the nullable callback arguments in the native headers across Apple platforms.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mark the image, photo, and challenge-definition results nullable in the named GameKit completion delegates, matching the native SDK headers. Remove the resolved xtro suppressions and delete the platform ignore files that are now empty.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Restore the existing DeclineInvite callback contract and its xtro suppression. Apple's native completion block has a different arity, which requires a separate compatibility-safe binding fix rather than a nullable annotation in this PR.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Bind the native NSError-only completion handler and expose a separate correctly typed callback and Task API. Keep the shipped two-argument DeclineInvite method virtual and forward it through the corrected binding so existing binaries, overrides, and null-handler calls continue to work; reserve the corrected name for XAMCORE_5_0. Remove the obsolete xtro suppression and verify both API shapes across Apple platforms with Cecil tests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 14:54
@rolfbjarne
rolfbjarne requested a review from dalexsoto as a code owner October 2, 2026 14:54

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.

Copilot review overview

🟡 Changes recommended

The legacy adapter has incorrect nullability annotations and is not marked obsolete according to established compatibility conventions.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Corrects GKTurnBasedMatch invite-decline callback marshalling while preserving the legacy API.

Changes:

  • Adds the corrected callback binding and compatibility adapter.
  • Adds Cecil regression coverage and removes the xtro suppression.
File Description
src/​gamekit.cs Corrects callback binding and adds legacy forwarding.
tests/​cecil-tests/​ApiTest.cs Verifies native and compatibility signatures.
tests/​xtro-sharpie/​api-annotations-dotnet/​common-GameKit.ignore Removes the resolved suppression.

Comment thread src/gamekit.cs Resolved
Comment thread src/gamekit.cs Resolved
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

rolfbjarne and others added 3 commits October 2, 2026 20:17
Hide the compatibility overload from completion while preserving its existing virtual signature. Remove its documentation exception now that obsolete hidden members no longer require coverage, and assert both attributes in the Cecil API regression test.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Assert that the generated asynchronous compatibility method inherits both the obsolescence notice and IntelliSense hiding on every Apple platform, so future binding generator changes cannot expose the misleading API again.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 18:21
@rolfbjarne rolfbjarne added the do-not-merge Do not merge this pull request label Oct 2, 2026
@rolfbjarne

Copy link
Copy Markdown
Member Author

Blocking until #26811 is merged (at which point this PR will have to be retargetted to main, and main probably also merged into this branch).

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.

Copilot review overview

🟡 Changes recommended

The legacy adapter has inaccurate nullability and the promised Cecil regression coverage is missing.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (2)

Comment thread src/gamekit.cs Resolved
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Base automatically changed from dev/rolf/fix-gklocalplayer-handler-nullability to main October 23, 2026 17:39
Reconcile the nullable GameKit deprecation message with upstream and remove the now-obsolete GameKit xtro suppression file. Retain the compatibility-preserving DeclineInvite binding while incorporating the latest main branch changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 09:05

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.

🔵 Needs a closer look

Legacy nullability remains inaccurate, and the promised signature and compatibility regression coverage is absent.

1 open issue

Review effort: Balanced

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

@rolfbjarne rolfbjarne removed the do-not-merge Do not merge this pull request label Oct 26, 2026
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #c111ea8] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

1 tests crashed, 1 tests failed, 213 tests passed.

Failures

❌ dotnettests tests (macOS)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppSizeTest.CoreCLR_R2R(MacOSX,"osx-arm64;osx-x64"...: App size changed significantly (+10,787 bytes (10.5 KB = 0.0 MB) different > tolerance of +-10,240 bytes (10.0 KB = 0.0 MB)). Ex...
    • Xamarin.Tests.BundleStructureTest.Build(MacOSX,"osx-x64",All,"Re...: '/Users/cloudtest/vss/_work/1/s/macios/tests/dotnet/BundleStructure/macOS/bin/Release/net11.0-macos/osx-x64/BundleStructure.app/...

Html Report (VSDrops) Download

❌ 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 (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 1 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 21 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 21 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 20 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
✅ Tests on macOS Golden Gate (27): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: c111ea8518bf5612d080997c4b4468ef23cb1b48 [PR build]

@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/43cc7cf25b5074c01884a8c3ba93201e
Updated files
  • MacOSX-CoreCLR-R2R-size.txt

Pipeline on Agent
Hash: c111ea8518bf5612d080997c4b4468ef23cb1b48 [PR build]

Update the branch against the latest target before evaluating the Cecil review feedback. Preserve upstream changes, including the removed Xamarin.MacDev submodule.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 12:12

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.

🔵 Needs a closer look

The legacy callback incorrectly declares non-nullable arguments despite receiving null, causing the generated async method to promise a non-nullable result that is always null while null-forgiving operators conceal the mismatch.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@MauiBot

MauiBot commented Dec 1, 2026

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: 1a7e296aec6613c0a83f73b0667a7838e3c7c5c2 [PR build]

@MauiBot

MauiBot commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #1a7e296] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 197 tests passed 🎉

Tests counts

✅ 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 1 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 17 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 17 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 17 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 17 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 19 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 19 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 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
✅ Tests on macOS Golden Gate (27): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 1a7e296aec6613c0a83f73b0667a7838e3c7c5c2 [PR build]

@rolfbjarne
rolfbjarne enabled auto-merge (squash) December 2, 2026 11:17
@rolfbjarne rolfbjarne added the ready-to-review This PR is ready to review/merge. label Dec 2, 2026
@rolfbjarne
rolfbjarne merged commit 51358d9 into main Dec 2, 2026
56 checks passed
@rolfbjarne
rolfbjarne deleted the dev/rolf/fix-declineinvite-binding branch December 2, 2026 14:27
rolfbjarne added a commit that referenced this pull request Dec 2, 2026
Preserve the GKChallengeState deprecation baseline added by this branch. Retain main's removal of the obsolete DeclineInvite callback suppression after its binding correction in #26813.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8a4efa71-7937-4254-83a8-0fa09ae5190b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot ready-to-review This PR is ready to review/merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants