feat: Support Zstandard-compressed assemblies on Android (.NET 11) - #5575
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
jamescrosswell
marked this pull request as ready for review
September 15, 2026 03:48
jamescrosswell
added this pull request to stack #5581
September 15, 2026 03:49
lucas-zimerman
left a comment
Collaborator
There was a problem hiding this comment.
Looking good! left some minor suggestions in regard to the code layout.
.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
force-pushed
the
feat/assemblystore-zstd
branch
from
September 16, 2026 01:34
082cf3e to
027018e
Compare
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>
This was referenced Sep 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.System.IO.Compression.ZstandardDecoderonnet11.0— no new package dependency.net10.0aXAZSpayload throwsNotSupportedExceptionwith a clear message instead of handing compressed bytes toPEReader(which failed with an obscureBadImageFormatException). Only .NET 11 apps produceXAZS, and those resolve thenet11.0build, so this is defensive.ArchiveUtilsTestsround-trip a real PE image through uncompressed, LZ4, Zstandard andMemorySliceinputs.Notes
XALZ. SoK4os.Compression.LZ4can't be dropped, contrary to the original motivation in Add support for Zstandard: dotnet/android tools/assembly-store-reader-mk2 @ 2e30614 #5346.AndroidAssemblyReaderTestsstay skipped onnet11.0. They also need variable index-entry sizing from Port upstream AssemblyStore reader changes: v4/CoreCLR format, _assembly_store symbol, index-entry sizing (next major) #5454 (.NET 11 stores use 9-byte index entries on 64-bit ABIs). With that hacked in locally, every compressed .NET 11 APK case reads assemblies successfully with this change.🤖 Generated with Claude Code