Skip to content

Fix WriteCompressedInt32 endianness on big-endian hosts - #517

Merged
akoeplinger merged 1 commit into
dotnet:mainfrom
medhatiwari:fix-compressed-int32-be
Sep 1, 2026
Merged

Fix WriteCompressedInt32 endianness on big-endian hosts#517
akoeplinger merged 1 commit into
dotnet:mainfrom
medhatiwari:fix-compressed-int32-be

Conversation

@medhatiwari

Copy link
Copy Markdown

Cecil’s WriteUInt16/WriteUInt32 are always little-endian. WriteCompressedInt32 copied SRM’s IsLittleEndian check, so on big-endian it writes swapped compressed ints into portable PDBs.

That landed in dotnet/cecil via #505 (608fac6, originally jbevain/cecil#958) and flowed into the VMR in [dotnet/dotnet#8250](dotnet/dotnet#8250. Native s390x VMR Mono then fails in ILLink while trimming System.Runtime (IL1012, ArgumentNullException / document).

Always ReverseEndianness before those writes. Round-trip tests do not catch this on little-endian, the new test asserts spec bytes (-100 → BF39, -9076 → DFFFB919).

cc: @tmds

@tmds

tmds commented Aug 31, 2026

Copy link
Copy Markdown
Member

@sbomer @agocke ptal.

@akoeplinger

Copy link
Copy Markdown
Member

can you please send an upstream PR to jbevain/cecil as well? thanks

@sbomer sbomer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@medhatiwari

Copy link
Copy Markdown
Author

can you please send an upstream PR to jbevain/cecil as well? thanks

yeah done here

@akoeplinger
akoeplinger merged commit 9e14a63 into dotnet:main Sep 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants