.agents/skills/issue-triage/references/skia-patterns.md
AI-specific domain knowledge for triage. Contains heuristics, platform quirks, and common traps that can't be inferred from general .NET knowledge.
For factual troubleshooting content (dlopen modes, container checklist), see documentation/dev/packages.md.
In a DllNotFoundException stack, the .NET runtime reports ALL fallback paths. Only the first error line matters — subsequent lines are "file not found" noise from fallback paths.
When user claims NoDependencies but error shows libfontconfig.so.1:
NoDependencies — deployment is brokenNoDependencies has zero external deps. Any dependency error PROVES a different binary was loaded. This is the #1 AI misdiagnosis — never dismiss dependency errors when NoDependencies is referenced.
| Issue | Pattern | Learning |
|---|---|---|
| #3386 | NoDependencies + fontconfig error | .NET Aspire / Azure Container Apps deployed wrong binary despite correct PackageReference. Workaround: switch to NativeAssets.Linux + install fontconfig. |
linux-musl-* RIDs. NoDependencies includes both glibc and musl. NativeAssets.Linux also includes both.ldd libSkiaSharp.so reveals which variant is deployed. NoDependencies shows only libc/libm/libpthread/libdl.SkiaSharp.NativeAssets.NanoServer, not Win32. NanoServer has a minimal API surface.NativeAssets.MacCatalyst), not macOS..a files linked into dotnet.wasm at build time via NativeFileReference. There is no .so or .dll to deploy.SKGLView will fail; use SKCanvasView (CPU) as fallback.Almost always a deployment issue: wrong NativeAssets package, missing native binary in output, or RID mismatch. Check documentation/dev/packages.md.
Self-contained publish should include native binaries. If not: NativeAssets package is in a library project (not the executable), or trimming removed it. Direct PackageReference in the application project fixes this.
The native binary exists but doesn't contain the expected function. Usually means: mismatched SkiaSharp managed + native versions, or (for contributors) native library not rebuilt after C API changes.
Memory management bug in the C# wrapper. Common causes: disposing an object that's still referenced by native code, using a disposed object, or threading violation (sharing SKCanvas/SKPaint between threads).
Some methods return the same instance they received. Disposing the result also disposes the input. Always check result != source before disposing. Methods that may return same instance: Subset(), ToRasterImage(), ToRasterImage(false).