.agents/skills/add-api/references/troubleshooting.md
Cause: Didn't commit in submodule before staging in parent
Fix: Always commit inside externals/skia/ FIRST, then git add externals/skia
# CORRECT order:
cd externals/skia
git add include/c/sk_*.h src/c/sk_*.cpp
git commit -m "Add sk_foo_bar to C API"
cd ../.. # Back to repo root
git add externals/skia # NOW stage in parent
Cause: Didn't run generator after C API changes
Fix: Run pwsh ./utils/generate.ps1 — NEVER skip this
Verify: git diff binding/SkiaSharp/SkiaApi.generated.cs should show new function
🛑 This is the #1 mistake when adding new APIs
Cause: You added a new C API function but didn't rebuild the native library. The pre-built natives from externals-download don't contain your new function.
Fix: Build the native library for your platform:
# macOS (Apple Silicon)
dotnet cake --target=externals-macos --arch=arm64
# macOS (Intel)
dotnet cake --target=externals-macos --arch=x64
# Windows (x64)
dotnet cake --target=externals-windows --arch=x64
Do NOT:
SkipException to work around itVerification: After building, run tests again — they should pass.
Cause: C API implementation bug, wrong pointer handling, incorrect parameters
Debug steps:
AsType/ToType) match the C++ typessk_ref_sp() used for ref-counted parameters.release() used for ref-counted returnsCause: Environment issue, missing dependencies, network problem
Fix:
Cause: Missing externals/native binaries
Fix depends on what you changed:
# If you ONLY changed C# code:
dotnet cake --target=externals-download
# If you changed C API (added/modified functions):
dotnet cake --target=externals-{platform} --arch={arch}
Verify:
ls output/native/