Skip to content

feat: Support Zstandard-compressed assemblies on Android (.NET 11) - #5575

Merged
jamescrosswell merged 5 commits into
version7from
feat/assemblystore-zstd
Sep 18, 2026
Merged

jamescrosswell merged 5 commits into
version7from
feat/assemblystore-zstd

Conversation

@jamescrosswell

Copy link
Copy Markdown
Collaborator

Stacked on #5574 — review that first; this PR's diff is only the Zstandard change.

.NET 11 compresses assemblies in the Android assembly store with Zstandard instead of LZ4 (dotnet/android#11730). The 12-byte header (magic / descriptor index / uncompressed length) is unchanged; only the magic (XALZ → XAZS) and the codec differ.

Closes #5346

Summary

  • ArchiveUtils.TryDecompressLZ4 → TryDecompress, which recognises both magics and dispatches to LZ4 or Zstandard.
  • Zstandard uses the BCL's System.IO.Compression.ZstandardDecoder on net11.0 — no new package dependency.
  • On net10.0 a XAZS payload throws NotSupportedException with a clear message instead of handing compressed bytes to PEReader (which failed with an obscure BadImageFormatException). Only .NET 11 apps produce XAZS, and those resolve the net11.0 build, so this is defensive.
  • New ArchiveUtilsTests round-trip a real PE image through uncompressed, LZ4, Zstandard and MemorySlice inputs.

Notes

🤖 Generated with Claude Code

@codecov

codecov Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (version7@8d4f28b). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             version7    #5575   +/-   ##
===========================================
  Coverage            ?   74.76%           
===========================================
  Files               ?      515           
  Lines               ?    18905           
  Branches            ?     3689           
===========================================
  Hits                ?    14134           
  Misses              ?     3893           
  Partials            ?      878           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jamescrosswell
jamescrosswell marked this pull request as ready for review September 15, 2026 03:48
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Sep 15, 2026
@jamescrosswell
jamescrosswell added this pull request to stack #5581 September 15, 2026 03:49
Comment thread src/Sentry.Android.AssemblyReader/ArchiveUtils.cs Outdated
Comment thread src/Sentry.Android.AssemblyReader/ArchiveUtils.cs Outdated

@lucas-zimerman lucas-zimerman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! left some minor suggestions in regard to the code layout.

Base automatically changed from feat/assemblystore-v4 to version7 September 16, 2026 01:34
jamescrosswell and others added 3 commits September 16, 2026 13:34
.NET 11 compresses assemblies with Zstandard (XAZS) instead of LZ4 (XALZ).
The 12-byte header is unchanged, so only the magic and the codec differ.
Zstandard uses the BCL ZstandardDecoder on net11.0; the net10.0 build
throws NotSupportedException, since only .NET 11 apps produce XAZS.

Refs #5346

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Assembly.Location is empty on Android, so the static initializer threw and
every test in the class failed on the device runs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jamescrosswell and others added 2 commits September 16, 2026 16:30
Magic numbers become internal constants the tests share, and the
DecompressZstandard helper is inlined - its assemblyName parameter was
unused on .NET 11.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@lucas-zimerman lucas-zimerman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jamescrosswell
jamescrosswell merged commit aa02031 into version7 Sep 18, 2026
38 checks passed
@jamescrosswell
jamescrosswell deleted the feat/assemblystore-zstd branch September 18, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

public API Additions/modifications to, or removals from, the public API surface area. risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Zstandard: dotnet/android tools/assembly-store-reader-mk2 @ 2e30614

2 participants