[Binding Creator] Enhance documentation for adding new frameworks and clarify Xtro checks - #26028
Conversation
… clarify Xtro checks
| > ⚠️ **Xcode 27: `simctl create` dropped `--json`.** mlaunch auto-creates the sim device via `simctl create … --json`, which now fails with `MT1008 … simctl: unrecognized option '--json'`. Workaround: **pre-create** the device with the exact name mlaunch expects so it finds it instead of creating it, e.g. `xcrun simctl create "iPhone 16 Pro - iOS 27.0" <devicetype-id> <runtime-id>`, then re-run mlaunch. (Environment-specific to Xcode 27 until mlaunch is updated.) | ||
|
|
There was a problem hiding this comment.
@rolfbjarne did copilot actually catch a bug or just needs better docs? 😂
There was a problem hiding this comment.
Yeah, this might be an mlaunch bug! mlaunch passing --json when creating simulators might just be accidental, and it worked in the past accidentally.
There was a problem hiding this comment.
Pull request overview
This PR improves the macios-binding-creator skill documentation to better guide contributors through (1) adding bindings for an entirely new Apple framework and (2) understanding what XTRO does and does not validate, plus a few high-impact test/debug workflow clarifications.
Changes:
- Added a cross-reference and warning in
SKILL.mdfor the extra build/test wiring required when binding a brand-new framework. - Expanded the test workflow reference to clarify XTRO selector coverage (native → managed only) and added practical notes for documentation baselines and desktop introspection pitfalls.
- Added a detailed “Registering a Brand-New Framework” checklist (with build gotchas) and additional binding patterns to
binding-patterns.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .agents/skills/macios-binding-creator/SKILL.md | Adds prominent warnings/links about brand-new framework wiring and correct preprocessor symbol ordering for Mac Catalyst. |
| .agents/skills/macios-binding-creator/references/test-workflow.md | Clarifies XTRO selector behavior, documentation baseline expectations, and adds troubleshooting guidance for simulator creation and desktop introspection. |
| .agents/skills/macios-binding-creator/references/binding-patterns.md | Introduces a checklist for registering new frameworks and documents build/test “gotchas” and NS_TYPED_ENUM set-wrapping patterns. |
| - **Unbound Objective-C class** → alias it to `Foundation.NSObject` with a `using` at the top of the API-definition file (a short comment naming the owning framework helps reviewers). Precedent: `src/browserenginekit.cs:47` aliases the XPC `xpc_object_t` type this way — `using OS_xpc_object = Foundation.NSObject;` — for its `xpc_object_t` parameters/returns. (This is *different* from platform-stubbing an otherwise-bound type under `#if` — for that, see "Platform Exclusion for Manual Types" below.) | ||
| - **C primitive** (`kern_return_t`, `IOReturn`, `io_service_t`, …) → map to a plain integer / `IntPtr`, never a bound type. Verified precedent: `kern_return_t` → `int` in `src/IOSurface/IOSurface.cs` (`// kern_return_t` → `public int Lock (...)`). For other C typedefs, confirm the width/signedness from the header before choosing `int`/`uint`/`nint`/`IntPtr`. | ||
|
|
||
| > ⚠️ Reviewers may ask "why not bind this type?" — the answer is that the owning framework is deliberately out of macios's scope (IOKit-family), so the NSObject-alias / integer fallback is the intended convention, not a shortcut. |
There was a problem hiding this comment.
HAHAHA those pesky human meatbags 😂
This comment has been minimized.
This comment has been minimized.
Mined four real Copilot sessions that ran the skill (Xcode 27 binding tasks: WebKit, VideoToolbox, Vision, UserNotifications) and fixed the gaps they exposed. All edits were triple-checked read-only by Opus 4.8, Sonnet 5, and GPT-5.5 (unanimous approval). - Error enums: add a NEVER-availability-attributes anti-pattern. The generic "each new enum member needs its own [iOS]" rule is build-breaking for error enums (cecil EnumTest.NoAvailabilityOnError, no allowlist). Hit in 2 of 4 sessions. - Enum members: rework the per-member availability rule to match the native header (add nothing when the member inherits), and add a multi-platform inheritance note (bgen back-fills the parent's older version via FindHighestIntroducedAttributes). - Elevate the named-delegate rule (never Action<T>/Func<T> for callbacks) into a SKILL.md Step 4 anti-pattern; it was buried in a reference and missed (required a user correction in WebKit). - Document introspection host-OS version gating in Step 6c: validate brand-new-SDK APIs on a matching-runtime simulator, not on a host macOS older than the SDK. - Add a training log under .agents/training-logs/. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5a002881-ea12-47a9-aed1-e64eb7b173c1
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| > ⚠️ **Xcode 27: `simctl create` dropped `--json`.** mlaunch auto-creates the sim device via `simctl create … --json`, which now fails with `MT1008 … simctl: unrecognized option '--json'`. Workaround: **pre-create** the device with the exact name mlaunch expects so it finds it instead of creating it, e.g. `xcrun simctl create "iPhone 16 Pro - iOS 27.0" <devicetype-id> <runtime-id>`, then re-run mlaunch. (Environment-specific to Xcode 27 until mlaunch is updated.) | ||
|
|
There was a problem hiding this comment.
Yeah, this might be an mlaunch bug! mlaunch passing --json when creating simulators might just be accidental, and it worked in the past accidentally.
Applied @rolfbjarne's review comments (skill approved, but several statements needed correcting). Each fix was verified against the repo and triple-checked read-only by GPT-5.6 Sol, Opus 4.8, Sonnet 5, and GPT-5.6 Terra. - Named delegates: downgrade the absolute "NEVER use Action<T>/Func<T>" rule to "PREFER a named delegate when a parameter's meaning isn't obvious" — Action<T>/Func<T> now support nullable type arguments, so the [NullAllowed] rationale is gone; named delegates still uniquely give parameter names + XML docs. (SKILL.md + binding-patterns.md) - Host-OS gating: remove the incorrect "(and may TCC-crash)". A member unavailable on the host OS is skipped by SkipDueToAttribute (IsAvailableOnHostPlatform), not crashed; TCC crashes are separate. - Introspection selectors: clarify ApiSelectorTest can't catch a privatized-but-still-implemented selector (respondsToSelector stays true), so don't rely on it to decide which bindings to remove. - Frameworks.cs sort: describe the real convention — grouped by the entry's OS version (newest last), case-insensitive alphabetical within each group — and note older groups have historical drift. - Cecil docs: lead with the WRITE_KNOWN_FAILURES=1 self-update; note the full-baseline rewrite can also drop now-fixed entries. - mlaunch --json: frame as a likely mlaunch bug. - Reference follow-up issues #26052 (generate-frameworks-constants not rebuilt when tools/common/Frameworks.cs changes) and #26053 (xtro report extra/unknown selectors), both filed at the maintainer's request. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5a002881-ea12-47a9-aed1-e64eb7b173c1
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
❗ API diff for current PR / commit (Breaking changes)NET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #5677708] Prepare .NET Release succeeded ✅📦 Published NuGet packages (32 packages)iOS
MacCatalyst
macOS
tvOS
Other
Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #b95a064] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 191 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
No description provided.