Skip to content

Validate native symbol packages after pack - #4856

Open
mattleibow wants to merge 13 commits into
mainfrom
mattleibow-validate-native-symbol-packages
Open

mattleibow wants to merge 13 commits into
mainfrom
mattleibow-validate-native-symbol-packages

Conversation

@mattleibow

@mattleibow mattleibow commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds all validation for the native symbol packages — the Apple UUID/completeness checks that run while the packages are being produced, and a cross-platform validator that runs afterwards against the real packed artifacts rather than making assumptions about the source tree.

Why: #4846 makes us produce Apple dSYM symbol packages (and we already produce Android .so.dbg ones). It is deliberately production-only — every check lives here. Nothing otherwise proves those packages are actually usable. A symbol package that is missing a slice, ships a truncated dSYM bundle, ships a DWARF payload under the wrong name, or whose UUIDs drift from the shipped runtime binary, still packs and publishes perfectly happily — and then silently fails to resolve a stack trace for a customer months later. The failure mode is invisible until it matters.

This PR closes that gap in three layers, each catching a different class of failure as close to its cause as possible.

1. Native build (xcode.cake, macOS)

Runs as the Apple native binaries are archived, where the toolchain output is still on disk:

  • the expected archived runtime was actually produced;
  • the expected dSYM DWARF exists at dSYMs/<module>.dSYM/Contents/Resources/DWARF/<payload>;
  • the DWARF payload is not code-signed;
  • staged dSYM archives exist at all;
  • runtime and dSYM UUIDs match two-way, with duplicate dSYM UUIDs rejected — a duplicate silently means two architectures were built from the same slice.

This layer may use dwarfdump, because it only ever runs on the macOS build job.

2. Pack (nuget.cake)

ValidateAppleSymbolPackages() runs inside nuget-normal, after the stable and preview packs but before the symbol packages are moved aside for signing, gated by --requireNativeSymbols. It walks the 8 product × platform specs and fails the pack itself the moment an Apple symbol package is malformed, keeping the failure next to the code that produced it rather than a stage later.

3. Post-pack (nuget-validate, cross-platform)

The layer above both: it runs over the finished artifacts in their published locations, covers Android as well as Apple, and adds cross-package identity checks the earlier layers cannot make.

Apple (SkiaSharp + HarfBuzzSharp × macOS / iOS / tvOS / MacCatalyst):

  • customer packages carry no dSYM/DWARF payload;
  • the symbol package preserves the normal package identity — id, version, curated metadata, dependency graph, and a byte-for-byte superset of the runtime payload;
  • dSYM bundles are complete, with Contents/Info.plist and the official extensionless Contents/Resources/DWARF/<module> payload name;
  • expected arm64 / x86_64 device and simulator coverage is present;
  • MacCatalyst additionally ships the unpacked real Versions/A/<library> Mach-O alongside framework.zip, and the binary actually inside that framework.zip — the only Mach-O a MacCatalyst customer ever consumes — is UUID-matched too;
  • runtime and dSYM UUID sets match two-way, per architecture.

Android (both products, all four packaged ABIs):

  • the customer package ships the stripped .so and no .dbg;
  • the symbols package ships both the module and its .so.dbg;
  • GNU build IDs match between the two.

For both platforms it then asserts that Microsoft.SymbolStore produces the same keys Arcade indexes with — mach-uuid / mach-uuid-sym for Apple, elf-buildid / elf-buildid-sym for Android. Because that runs against the real artifacts before publication, it is the pre-publication equivalent of a post-promotion MSDL/SymWeb lookup: if the key generator emits the expected key here, a debugger will resolve the symbol after promotion. Post-promotion retrieval genuinely cannot run in this stage, so this is deliberately the closest correct substitute rather than a weaker approximation of it.

Two constraints shaped this third layer specifically:

  • It has to run on the Windows package job, so dwarfdump, otool and lipo are out — which is exactly why it cannot simply be folded into layer 1. The Mach-O and ELF readers are fully managed.
  • No new feed, no unpinned download. Microsoft.SymbolStore / Microsoft.FileFormats are not published standalone on our feeds, but they ship inside the already-pinned Microsoft.SymbolUploader.Build.Task on the existing dotnet-eng feed — the same implementation Arcade itself indexes with. It is referenced with ExcludeAssets="all" PrivateAssets="all" so it contributes nothing to any shipping package.

How it runs. A new nuget-validate Cake target invokes the validator against the packed output directories, passing the same preview suffix the pack used so both the stable and preview channels are covered. dotnet cake --target=nuget depends on it, so packing locally validates what it just produced. DotNetRun throws on a non-zero exit code, so a validation failure fails the build. The validator's own regression suite runs first — logic that has regressed cannot be trusted to sign off on the packages.

In CI, the existing scan_normal_windows job becomes the validation job. It already waited for packaging and already downloaded both the normal and symbol artifact sets, but it used the merger template, which hard-codes skipSteps and would silently swallow any target given to it; switching it to the bootstrapper lets it run Cake after both artifact sets have landed. It deliberately opts out of build caching — a cached job sets CACHE_SKIP and skips its steps, and validation that can be skipped is not validation. It runs with --requireAll=true, so a package that failed to produce is a hard failure rather than a silent skip.

It reads package versions straight from scripts/VERSIONS.txt (rather than taking 10+ version arguments) and covers both stable and preview identities. On a dev box a package that was not produced on the current platform is skipped, so the target is useful locally; --require-all fails closed for the full-matrix CI run.

Stacking / merge order. This is the second PR in the native stack main <- #4846 <- #4856 <- #4803 and is based on mattleibow-apple-symbol-packaging-7c4. #4846 produces the packages and contains no validation; this PR contains the validation end-to-end. #4846 merges first.

Invocation, for reference:

--packages <dir> --symbol-packages <dir> --versions-file scripts/VERSIONS.txt
    [--preview-suffix <suffix>] [--require-all] [--verbose]

Exit codes: 0 pass, 1 validation failure, 2 usage error. All problems are accumulated and reported in one run rather than failing on the first.

Related issues

Related to #4846

Required skia PR

None.

Areas affected

  • Managed API (binding/)
  • Native / C API (externals/skia/src/c, include/c)
  • Generated P/Invoke bindings
  • Native dependency or Skia update (libpng, HarfBuzz, FreeType, zlib, milestone bump, …)
  • Views & integrations (MAUI, Uno, WPF, WinUI, Blazor, …)
  • Rendering output / visual behavior
  • Performance
  • Tests
  • Build, packaging, or CI
  • Documentation or samples

Changes

None — no public API or behavior change. This adds build-time validation and the CI/Cake wiring that runs it; it ships in no package and is not referenced by any shipping project.

Testing

Verified locally on macOS (arm64) with the repo-pinned SDK:

  • 64 tests, all passing (dotnet test .../NativeSymbolValidator.Tests). The suite builds real .nupkg archives on disk from hermetic synthetic Mach-O / fat Mach-O / MH_DSYM / ELF-with-build-ID fixtures and runs the real validators over them — no mocks, no network, no platform tooling.
    • Apple: happy path across all 8 product × platform specs, plus UUID mismatch, missing Contents/Info.plist, unofficial DWARF payload name, missing architecture dSYM, module missing an architecture, debug payload leaked into the customer package, MacCatalyst missing its unpacked Mach-O, MacCatalyst leaking an unpacked framework, corrupt module, fat dSYM, and non-dSYM DWARF payload.
    • MacCatalyst framework.zip specifically: a zip carrying a different binary, a zip missing the binary, and a framework.zip that is not a zip at all.
    • Malformed-input hardening: truncated modules and truncated DWARF payloads that still carry valid magic must fail with a diagnosable error rather than crash, and a fat Mach-O with an unreadable slice must fail rather than silently drop that slice and compare two equally-truncated sets.
    • Android: happy path per product, plus .dbg leaked into the customer package, missing debug file, build-ID mismatch, unstripped library, missing ABI, corrupt debug file, a truncated library, and a library with no GNU build ID.
    • End-to-end Validator.Run(): skip-when-not-produced, --require-all failing closed, a package produced without its symbol package, an unrecognised *.NativeAssets.* symbol package appearing on disk (including the case where a shorter product id shares its prefix), the Windows NativeAssets packages that legitimately produce symbol packages outside the matrix, and a guard that every id in the matrix actually has a nuget version in scripts/VERSIONS.txt.
    • Wiring regression: the tests read the committed scripts/azure-templates-stages-package.yml, build.cake and nuget.cake, so the scan job cannot quietly stop downloading an artifact set, stop invoking the validator, or start allowing itself to be cached away.
  • dotnet cake --target=tests-apple-symbols → passes. Covers the native layer's UUID reconciliation directly: a matching runtime/dSYM set, plus missing, duplicate and wrong UUID cases that must each be rejected.
  • The happy-path Apple/Android tests pass only because Microsoft.SymbolStore really does emit the expected mach-uuid / mach-uuid-sym / elf-buildid keys for those binaries — those assertions are hard errors in the validator, not warnings.
  • dotnet cake --target=nuget-validate --requireAll=false → enumerates the full 20-entry matrix (10 stable + 10 preview), skips what this box did not pack, exits 0.
  • dotnet cake --target=nuget-validate --requireAll=true → reports every missing package individually and fails the Cake build. This is the mode that matters most: a validator that quietly passes when it validated nothing is worse than no validator.
  • Exit-code contract verified end-to-end: a malformed argument exits 2 with usage, a validation failure exits 1, a clean skip exits 0 — each with a diagnosable message rather than a stack trace.
  • Both validator projects build with 0 warnings, 0 errors, which also confirms Microsoft.SymbolStore / Microsoft.FileFormats restore cleanly out of the pinned Microsoft.SymbolUploader.Build.Task with no feed change.
  • Key-generation behavior was additionally verified during development against real fixtures built with clang / lipo / dsymutil — a fat arm64+x86_64 dylib, its dsymutil-produced dSYM, and real .so / .so.dbg pairs — confirming the exact key shapes asserted here, and that a dSYM's identity key is byte-identical to its module's symbol key.

What I could not test: the post-pack validator has not run against real packed Apple .symbols.nupkgs, because producing those needs the full native Apple build matrix, which cannot run on this box. The first CI run on the package stage is the real proof. The dependency this has on the native artifact carrying the *.xcarchive/dSYMs/** trees has since been confirmed by the #4846 author: the native source jobs publish their complete output directories and the merger/download templates copy artifact contents recursively without filtering, and prior successful build 1564081 consumed that same merged native artifact and produced the complete Apple symbol packages that were inspected by hand. So --requireAll=true is expected to be satisfiable on the first run rather than optimistic.

Checklist

  • Tests added or updated (if omitted, explain why above)
  • Changes above lists all public API and behavioral changes (or "None.")
  • New/changed public API? Filed a docs issue in mono/SkiaSharp-API-docs so reference docs can be written later — n/a, no public API
  • Native change? Companion mono/skia PR linked above and bindings regenerated — n/a, no native change

Copilot AI added 7 commits August 22, 2026 10:59
Generate stable Apple symbols packages from the normal Cake NuGet flow, validate archive UUIDs, and add post-promotion retrieval checks for MSDL and SymWeb.

Co-authored-by: Copilot App <[email protected]>
Use shared MSBuild packaging targets to emit complete Apple dSYM symbol packages directly from dotnet pack, preserving normal runtime packages and Catalyst framework handling.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 28a5c16a-00b3-4742-ba7f-abc43845afbc
Declare each dSYM bundle once and let the shared MSBuild target expand its contents and completeness checks.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 28a5c16a-00b3-4742-ba7f-abc43845afbc
Derive runtime packing, symbol-only content, and completeness validation from one declaration per physical Apple artifact.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 28a5c16a-00b3-4742-ba7f-abc43845afbc
Derive symbol packaging from native artifact items, emit stable and preview symbols uniformly, and use the repository's existing relative native paths.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 28a5c16a-00b3-4742-ba7f-abc43845afbc
Keep existing runtime PackageFile declarations and use one generic PackageSymbolFile item for second-pass symbol package content.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 28a5c16a-00b3-4742-ba7f-abc43845afbc
Move native symbol validation out of the production change and clean package output directories before each complete repack.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 28a5c16a-00b3-4742-ba7f-abc43845afbc
@github-actions

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4856

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4856"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-4856/packages --name skiasharp-pr-4856
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-4856

@mattleibow
mattleibow changed the base branch from mattleibow-apple-symbol-packaging-7c4 to main August 24, 2026 17:28
mattleibow pushed a commit that referenced this pull request Aug 24, 2026
Integrate the cross-platform native symbol package validator as the middle layer beneath the dnceng migration PR.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 4b716c9b-78fe-4fd9-a242-31e192b5aa77
@mattleibow
mattleibow changed the base branch from main to mattleibow-apple-symbol-packaging-7c4 August 24, 2026 17:34
@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

📊 SkiaSharp benchmarks — PR #4856

⭐ this PR (full source build) vs 🌙 nightly · Linux · Windows · macOS

Informational only — this never blocks the PR. 🟢 faster / less allocation · 🔴 slower / more allocation; moves under 5% are hidden as noise.

⏱️ Times are raw BenchmarkDotNet means, and the ⭐ PR and baseline legs run on separate CI runners, so microbenchmarks can swing run-to-run — treat small time deltas as noise. Allocations are deterministic and the reliable signal. The interactive perf-dashboard (linked below) applies smoothing for the trend view.

Highlights

⏱️ Time — 🔴 26 slower · 🟢 55 faster

  • 🔴 CanvasDrawBenchmark.Draw(Shapes: 64) · macOS · 1.40 ms → 2.13 ms (+53%)
  • 🟢 RuntimeEffectShaderBenchmark.DrawFrame · Windows · 1.13 ms → 567.14 µs (-50%)
  • 🟢 ColorMathBenchmark.ToColor(Colors: 4096) · Windows · 15.66 µs → 8.06 µs (-49%)
  • 🔴 MatrixMapPointsBenchmark.MapRect(Points: 4096) · macOS · 55.48 µs → 79.78 µs (+44%)
  • 🟢 ColorMathBenchmark.UnPreMultiply(Colors: 4096) · Windows · 12.27 µs → 6.98 µs (-43%)
  • …and 76 more (see details below)
Full per-OS benchmark deltas

Linux

⏱️ Time (vs 🌙 nightly 4.152.0-nightly.46)

Benchmark baseline this PR Δ
RasterImageLifecycleBenchmark.CreateDataWithReleaseProc(Count: 256) 95.94 µs 111.38 µs 🔴 +16%
MatrixOpsBenchmark.Invert(Count: 4096) 149.24 µs 127.64 µs 🟢 -14%
MatrixMapPointsBenchmark.MapRect(Points: 4096) 203.44 µs 176.02 µs 🟢 -13%
MatrixMapPointsBenchmark.MapRect(Points: 256) 12.60 µs 10.97 µs 🟢 -13%
MatrixOpsBenchmark.Concat(Count: 4096) 246.03 µs 217.37 µs 🟢 -12%
ColorMathBenchmark.PreMultiply(Colors: 4096) 14.50 µs 12.86 µs 🟢 -11%
MatrixMapPointsBenchmark.MapRadius(Points: 4096) 244.16 µs 216.94 µs 🟢 -11%
MatrixMapPointsBenchmark.MapRadius(Points: 256) 15.21 µs 13.57 µs 🟢 -11%
MatrixMapPointsBenchmark.MapPoint(Points: 256) 5.13 µs 4.60 µs 🟢 -10%
PathBoundsBenchmark.TightBounds(Points: 1024) 11.15 µs 10.11 µs 🟢 -9%
MatrixMapPointsBenchmark.MapPoints(Points: 256) 233.6 ns 213.0 ns 🟢 -9%
MatrixMapPointsBenchmark.MapVector(Points: 4096) 190.66 µs 174.19 µs 🟢 -9%
MatrixMapPointsBenchmark.MapPoint(Points: 4096) 80.62 µs 73.78 µs 🟢 -8%
RasterImageLifecycleBenchmark.CreateRasterImage(Count: 256) 243.29 µs 261.08 µs 🔴 +7%
MatrixMapPointsBenchmark.MapVector(Points: 256) 11.93 µs 11.12 µs 🟢 -7%
ColorMathBenchmark.ToColorF(Colors: 4096) 14.03 µs 13.12 µs 🟢 -7%
MatrixMapPointsBenchmark.MapPoints(Points: 4096) 2.69 µs 2.52 µs 🟢 -6%
ColorMathBenchmark.UnPreMultiply(Colors: 4096) 12.89 µs 12.12 µs 🟢 -6%
RuntimeEffectShaderBenchmark.DrawFrame 3.03 ms 2.85 ms 🟢 -6%
CanvasDrawBenchmark.Draw(Shapes: 512) 34.97 ms 33.21 ms 🟢 -5%

Windows

⏱️ Time (vs 🌙 nightly 4.152.0-nightly.46)

Benchmark baseline this PR Δ
RuntimeEffectShaderBenchmark.DrawFrame 1.13 ms 567.14 µs 🟢 -50%
ColorMathBenchmark.ToColor(Colors: 4096) 15.66 µs 8.06 µs 🟢 -49%
ColorMathBenchmark.UnPreMultiply(Colors: 4096) 12.27 µs 6.98 µs 🟢 -43%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 256) 926.70 µs 534.48 µs 🟢 -42%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 256) 1.32 ms 764.41 µs 🟢 -42%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 64) 247.51 µs 146.03 µs 🟢 -41%
ColorMathBenchmark.PreMultiply(Colors: 4096) 13.18 µs 7.80 µs 🟢 -41%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 64) 334.87 µs 202.74 µs 🟢 -39%
CanvasDrawBenchmark.Draw(Shapes: 512) 21.22 ms 13.85 ms 🟢 -35%
MatrixMapPointsBenchmark.MapPoint(Points: 256) 4.87 µs 3.19 µs 🟢 -35%
ColorParseBenchmark.Parse(Iterations: 1000) 77.05 µs 51.25 µs 🟢 -33%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 2048) 10.32 ms 6.93 ms 🟢 -33%
MatrixMapPointsBenchmark.MapPoint(Points: 4096) 76.03 µs 51.50 µs 🟢 -32%
MatrixOpsBenchmark.Concat(Count: 4096) 225.42 µs 154.25 µs 🟢 -32%
CanvasDrawBenchmark.Draw(Shapes: 64) 2.65 ms 1.81 ms 🟢 -31%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 1024) 2.56 ms 1.78 ms 🟢 -30%
MatrixOpsBenchmark.Invert(Count: 4096) 132.70 µs 93.08 µs 🟢 -30%
MatrixMapPointsBenchmark.MapRect(Points: 256) 8.01 µs 5.63 µs 🟢 -30%
SceneRenderBenchmark.RenderFrame(Complexity: 1) 2.18 ms 1.58 ms 🟢 -27%
MatrixMapPointsBenchmark.MapVector(Points: 256) 7.99 µs 5.85 µs 🟢 -27%
MatrixMapPointsBenchmark.MapRadius(Points: 256) 9.05 µs 6.69 µs 🟢 -26%
MatrixMapPointsBenchmark.MapRadius(Points: 4096) 144.80 µs 108.36 µs 🟢 -25%
SceneRenderBenchmark.RenderFrame(Complexity: 4) 10.07 ms 7.69 ms 🟢 -24%
PathBoundsBenchmark.TightBounds(Points: 1024) 15.70 µs 12.00 µs 🟢 -24%
MatrixMapPointsBenchmark.MapVector(Points: 4096) 121.24 µs 92.73 µs 🟢 -24%
…and 6 more

macOS

⏱️ Time (vs 🌙 nightly 4.152.0-nightly.46)

Benchmark baseline this PR Δ
CanvasDrawBenchmark.Draw(Shapes: 64) 1.40 ms 2.13 ms 🔴 +53%
MatrixMapPointsBenchmark.MapRect(Points: 4096) 55.48 µs 79.78 µs 🔴 +44%
MatrixMapPointsBenchmark.MapPoints(Points: 256) 131.8 ns 188.1 ns 🔴 +43%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 64) 183.91 µs 259.31 µs 🔴 +41%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 64) 216.71 µs 303.84 µs 🔴 +40%
MatrixMapPointsBenchmark.MapPoint(Points: 4096) 21.50 µs 28.56 µs 🔴 +33%
MatrixMapPointsBenchmark.MapPoints(Points: 4096) 1.87 µs 2.39 µs 🔴 +28%
ColorMathBenchmark.ToColorF(Colors: 4096) 4.90 µs 6.14 µs 🔴 +25%
CanvasDrawBenchmark.Draw(Shapes: 512) 11.04 ms 13.77 ms 🔴 +25%
SceneRenderBenchmark.RenderFrame(Complexity: 1) 1.78 ms 1.40 ms 🟢 -21%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 256) 843.45 µs 1.02 ms 🔴 +21%
MatrixMapPointsBenchmark.MapRadius(Points: 256) 6.15 µs 7.31 µs 🔴 +19%
ColorMathBenchmark.UnPreMultiply(Colors: 4096) 7.73 µs 9.17 µs 🔴 +19%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 1024) 748.26 µs 641.00 µs 🟢 -14%
RasterImageLifecycleBenchmark.CreateDataWithReleaseProc(Count: 256) 76.26 µs 86.84 µs 🔴 +14%
MatrixOpsBenchmark.Invert(Count: 4096) 76.44 µs 66.68 µs 🟢 -13%
ColorMathBenchmark.PreMultiply(Colors: 4096) 9.07 µs 10.18 µs 🔴 +12%
MatrixMapPointsBenchmark.MapVector(Points: 4096) 42.58 µs 47.56 µs 🔴 +12%
ColorParseBenchmark.Parse(Iterations: 1000) 73.74 µs 81.77 µs 🔴 +11%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 256) 604.42 µs 667.62 µs 🔴 +10%
MatrixMapPointsBenchmark.MapRect(Points: 256) 3.26 µs 3.60 µs 🔴 +10%
MatrixMapPointsBenchmark.MapVector(Points: 256) 2.53 µs 2.79 µs 🔴 +10%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 2048) 2.65 ms 2.45 ms 🟢 -8%
RuntimeEffectShaderBenchmark.DrawFrame 668.99 µs 626.86 µs 🟢 -6%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 2048) 5.78 ms 6.13 ms 🔴 +6%
…and 5 more

📈 Full interactive perf-dashboard & run details →

mattleibow pushed a commit that referenced this pull request Aug 24, 2026
Integrate native symbol package validation into the dnceng migration layer and adapt it to the unified NuGet artifact topology.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 4b716c9b-78fe-4fd9-a242-31e192b5aa77

# Conflicts:
#	scripts/azure-templates-stages-package.yml
Require each Xcode archive dSYM to match its runtime UUID and verify the final universal runtime has exactly the staged per-architecture UUID set. Fail official Windows packaging unless all stable and preview Apple symbol packages contain the expected runtime modules and dSYM payloads, while leaving partial package builds unchanged.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 28a5c16a-00b3-4742-ba7f-abc43845afbc
@mattleibow
mattleibow force-pushed the mattleibow-validate-native-symbol-packages branch from c50c794 to ed2d14e Compare August 24, 2026 18:20
@github-actions

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been deployed and is available at:

🔗 View Staging Site
🔗 View Staging Docs
🔗 View Staging Gallery (Blazor)
🔗 View Staging Gallery (Uno Platform)
🔗 View Staging SkiaFiddle

This preview will be updated automatically when you push new commits to this PR.


This comment is automatically updated by the documentation staging workflow.

Copilot AI added 5 commits August 24, 2026 21:05
Move native UUID checks, package completeness checks, and their regressions to the stacked validator change so this pull request only produces Apple symbol packages.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 28a5c16a-00b3-4742-ba7f-abc43845afbc
Require each Xcode archive dSYM to match its runtime UUID and verify the final universal runtime has exactly the staged per-architecture UUID set. Fail official Windows packaging unless all stable and preview Apple symbol packages contain the expected runtime modules and dSYM payloads, while leaving partial package builds unchanged.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 28a5c16a-00b3-4742-ba7f-abc43845afbc
Adds a standalone console tool that validates the real packed
`.nupkg` / `.symbols.nupkg` artifacts produced by the normal Cake
pack, rather than making assumptions about the source tree.

Apple (SkiaSharp + HarfBuzzSharp, macOS/iOS/tvOS/MacCatalyst):
- customer packages carry no dSYM/DWARF payload;
- the symbol package preserves the normal package id, version, curated
  metadata, dependency graph and byte-for-byte runtime payload;
- dSYM bundles are complete, with `Contents/Info.plist` and the official
  extensionless `Contents/Resources/DWARF/<module>` payload name;
- arm64 and x86_64 device/simulator coverage is present;
- MacCatalyst additionally ships the unpacked real
  `Versions/A/<library>` Mach-O alongside `framework.zip`;
- runtime and dSYM UUID sets match two-way, per architecture.

Android (both products, all four packaged ABIs):
- the customer package ships the stripped `.so` and no `.dbg`;
- the symbols package ships both the module and its `.so.dbg`;
- GNU build IDs match between the two.

For both platforms the tool asserts that Microsoft.SymbolStore produces
the same keys Arcade indexes with — `mach-uuid` / `mach-uuid-sym` for
Apple and `elf-buildid` / `elf-buildid-sym` for Android — so a debugger
will resolve the published symbols. Because that check runs on the real
artifacts before publication, it is the pre-publication equivalent of a
post-promotion MSDL/SymWeb lookup.

Microsoft.SymbolStore and Microsoft.FileFormats are taken from the
already-pinned `Microsoft.SymbolUploader.Build.Task` package on the
existing `dotnet-eng` feed, so this adds no new feed and no unpinned
download. The Mach-O and ELF readers are managed, so the validator
deliberately avoids macOS-only tooling such as `dwarfdump`, `otool` and
`lipo` and can run on the Windows package job.

Reads package versions straight from `scripts/VERSIONS.txt` and covers
both stable and preview identities. By default a package that was not
produced on the current platform is skipped; `--require-all` fails
closed for full-matrix CI runs.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 9e6eac8f-9dc1-4268-8819-da125d2d700d
The validator added in the previous commit was a tool nobody called. Wire it
into the packaging flow so the packed artifacts are actually checked.

A new `nuget-validate` Cake target runs the validator against the real packed
output directories, passing the same preview suffix the pack used so both the
stable and preview channels are covered. `dotnet cake --target=nuget` now
depends on it, so packing locally validates what it just produced. Because
`DotNetRun` throws on a non-zero exit code, a validation failure fails the
build. The validator's own regression suite runs first: logic that has
regressed cannot be trusted to sign off on the packages.

In CI, `scan_normal_windows` becomes the validation job. It already waited for
packaging and already downloaded both the normal and symbol artifact sets, but
it used the merger template, which hard-codes `skipSteps` and would silently
swallow any target given to it. Switching it to the bootstrapper lets it run
Cake after both artifact sets have landed. It deliberately opts out of build
caching: a cached job sets `CACHE_SKIP` and skips its steps, and validation
that can be skipped is not validation.

The wiring is covered by tests that read the committed pipeline and build
definitions, so the scan job cannot quietly stop downloading an artifact set,
stop invoking the validator, or start allowing itself to be cached away.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 9e6eac8f-9dc1-4268-8819-da125d2d700d
A read-only review of the validator surfaced seven defects, all of which let a
real packaging regression reach customers or turned a bad package into a crash.

The unknown-symbol-package guard never fired. It resolved a file's owning
package by matching the file name against the version keys, and scripts/VERSIONS.txt
lists the bare `SkiaSharp` and `HarfBuzzSharp` products before their
`.NativeAssets.*` entries, so every input resolved to the bare product and failed
the `.NativeAssets.` test. The identity now comes from the nuspec. Longest-prefix
matching would not have been enough either, because the Win32, WinUI and
NanoServer packages legitimately produce symbol packages from the same
IncludeSymbols switch; those are now an explicit allow-list.

MacCatalyst reconciliation never reached the binary customers consume. Catalyst
ships only `<lib>.framework.zip`, and the validator merely asserted that entry
existed while running the whole UUID chain against the unpacked Mach-O that lives
only in the symbol package. A stale zip would have passed. The zip's inner
`Versions/A/<lib>` is now opened and its UUIDs anchored to the module.

Corrupt input crashed instead of reporting. Microsoft.FileFormats treats
OverflowException as expected for malformed images, and GetSymbolStoreKeys forced
lazy key generation with no handling at all, so a truncated binary aborted the run
rather than failing the package. Malformed-image exceptions are now caught
consistently and reported.

A fat Mach-O with an unreadable slice silently lost it, under-reporting the
architecture and UUID sets. When the loss hit matching slices on both the module
and dSYM sides, reconciliation compared two equally truncated sets and passed.
Unreadable slices are now surfaced and fail the package.

Every extracted binary was retained for the whole run. With roughly a hundred
extractions and DWARF payloads in the hundreds of megabytes, peak usage reached
multiple gigabytes on a hosted agent. Extraction is now scoped to its use.

NuGetPackage.Open leaked the ZipArchive and FileStream when the package was not a
valid archive, leaving the .nupkg locked for the later signing and move steps on
the same Windows job.

Finally, the documented exit codes were not honoured: a malformed command line or
a missing version threw out of Main and reported a crash instead of 2 or 1.

Regression coverage is added for each: the prefix collision that hid the first
defect, the allow-listed Windows packages, a stale and an empty Catalyst zip,
truncated-but-valid-magic Mach-O and ELF images, and a fat image with a damaged
slice. The Catalyst fixture now builds a real zip rather than a placeholder, which
is what caught the missing anchor.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 9e6eac8f-9dc1-4268-8819-da125d2d700d
@mattleibow
mattleibow force-pushed the mattleibow-validate-native-symbol-packages branch from 1425519 to a58f8c6 Compare August 24, 2026 19:09
Base automatically changed from mattleibow-apple-symbol-packaging-7c4 to main August 25, 2026 19:23
@github-actions

Copy link
Copy Markdown
Contributor

📦 Artifact size report

Packages from this PR (build 1567453) vs the latest nightly baseline 4.152.0-nightly.47 (observed 2026-08-25).

Total .nupkg size: 569.6 MB → 569.0 MB (−666.7 KB, -0.1%)

Packages

⚠️ marks growth over 500.0 KB or 2%. Changes under 50.0 KB are treated as noise.

Package baseline this PR Δ Δ%
SkiaSharp.NativeAssets.WinUI 109.1 MB 108.3 MB 🟢 −764.2 KB -0.7%
SkiaSharp.NativeAssets.WebAssembly 69.7 MB 69.7 MB 🔴 +75.1 KB +0.1%

+39 package(s) unchanged (< 50.0 KB).

Per-file changes

SkiaSharp.NativeAssets.WinUI

File Size
runtimes/win-arm64/native/libGLESv2.pdb 64.5 MB → 64.4 MB (🟢 −144.0 KB)
runtimes/win-x64/native/libGLESv2.pdb 66.6 MB → 66.5 MB (🟢 −96.0 KB)
runtimes/win-x86/native/libGLESv2.pdb 67.3 MB → 67.2 MB (🟢 −96.0 KB)

Informational only — this never blocks the PR. Native binaries are labelled by os/arch.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants