[skills] Improve macios-binding-creator skill#25133
Conversation
…member availability Training session evidence: sessions d8792953 (SystemConfiguration), 91f91750 (MediaSetup), 28911011 (Photos). User corrections showed two skill gaps: 1. Availability version determination: The skill previously directed agents to use SdkVersions.cs for ALL availability versions, which is only correct for brand-new APIs. When introducing a framework on a new platform (e.g., MediaSetup → MacCatalyst), the actual introduction version differs from the current SDK version. Now directs agents to use generated reference bindings as the primary source of truth for introduction versions. 2. Per-member enum availability: When adding new members to existing enums, each member needs its own availability attribute with the member's introduction version. Added explicit guidance and code example. Multi-model validation (Sonnet 4, GPT-5.1, Haiku 4.5): Before: Accuracy 2/5, Completeness 2/5, Clarity 2/5 After: Accuracy 5/5, Completeness 5/5, Clarity 5/5 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…g-creator Add documentation for registering NativeObject subclasses as bgen marshal types, addressing a critical knowledge gap discovered during PrintCore binding work (session 1a7e421e). Without this guidance, agents default to IntPtr returns for protocol methods even when concrete managed wrappers exist, requiring extensive user intervention to discover the TypeCache + MarshalTypeList registration pattern. Changes: - New section 'NativeObject Return Types in Protocol Methods' in binding-patterns.md with full 5-step workflow: CORE_SOURCES → #if !COREBUILD guards → TypeCache registration → MarshalTypeList registration → use concrete types in API definitions - Enhanced frameworks.sources docs to explain FRAMEWORKNAME_CORE_SOURCES for making types visible to bgen's core assembly - Extended #if !COREBUILD guidance from struct-only to include NativeObject class shells (referencing StoreProductParameters.cs, CGColor.cs patterns) - Added cross-reference in SKILL.md Step 4 warning against IntPtr when managed NativeObject wrappers exist Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
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.
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.
Train the macios-binding-creator skill based on ARKit binding session (62c564f6) where the agent needed user corrections for three issues: 1. Named types Ar* instead of AR* — the naming guidance was ambiguous about ObjC class prefixes vs .NET acronym rules. Added explicit rule that C# type names preserve ObjC prefix casing exactly (AR*, AV*, CG*) while .NET acronym rules only apply to property/method names. 2. Used MACOS_DOTNET_SOURCES instead of #if MONOMAC — added guidance and anti-pattern clarifying that preprocessor directives are preferred over platform-specific source file lists, with a table of available symbols. 3. Implemented callback handler with null safety issues — added new 'C Callback Handler Binding' section covering BlockLiteral trampoline and GCHandle patterns, with rules for null safety on nullable parameters and memory management ordering when replacing handlers. Also adds the training log documenting both training sessions (PrintCore and ARKit) with assessment, changes, and patterns learned. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5704c2e to
6e8e111
Compare
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.
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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| **Outcome:** ✅ Changes kept. All five edits address direct user corrections or code review findings from the session. | ||
|
|
||
| ### Patterns Learned | ||
| - **Type name prefix ≠ acronym** — The .NET "don't use all-caps acronyms" rule only applies within property/method names. ObjC type prefixes (AR*, AV*, CG*, CK*) are preserved exactly. The existing skill guidance was ambiguous enough for the agent to misapply it. |
There was a problem hiding this comment.
There can be acronyms within type names as well (NSURLSessionHandler); the prefix (NS) is kept upper-case, while the acronym inside the type name (URL) is not.
|
|
||
| #### Key Rules for Callback Handlers | ||
|
|
||
| > ❌ **NEVER** access a nullable parameter (e.g., `DispatchQueue? queue`) without null-checking it first. If `handler` is null and `queue` is also null, calling `queue.GetHandle()` throws `NullReferenceException`. Check all nullable parameters before use on every code path. |
There was a problem hiding this comment.
This is wrong: calling .GetHandle() is safe (from a NullReferenceException perspective) - it'll return NativeHandle.Zero on a null instance.
|
|
||
| ```csharp | ||
| // macOS-only type or member | ||
| #if MONOMAC |
There was a problem hiding this comment.
We should ideally use __MACOS__ over MONOMAC (eventually I'd like to remove the MONOMAC symbol completely, it's redundant to have two symbols with the same meaning).
| |--------|----------| | ||
| | `MONOMAC` / `__MACOS__` | macOS | | ||
| | `__IOS__` | iOS | | ||
| | `TVOS` / `__TVOS__` | tvOS | |
There was a problem hiding this comment.
Same, prefer __TVOS__ over TVOS.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #d10c652] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #d10c652] Build passed (Detect API changes) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (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.
✅ [CI Build #d10c652] Build passed (Build macOS tests) ✅Pipeline on Agent |
🔥 [CI Build #d10c652] Test results 🔥Test results❌ Tests failed on VSTS: test results 1 tests crashed, 0 tests failed, 153 tests passed. Failures❌ windows tests🔥 Failed catastrophically on VSTS: test results - windows (no summary found). Html Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
No description provided.