Skip to content

Fix embedded source decoding on big-endian platforms in DiaSymReader#386

Merged
tmat merged 2 commits intodotnet:mainfrom
Venkad000:bigendianfix
Feb 11, 2026
Merged

Fix embedded source decoding on big-endian platforms in DiaSymReader#386
tmat merged 2 commits intodotnet:mainfrom
Venkad000:bigendianfix

Conversation

@Venkad000
Copy link
Copy Markdown
Contributor

@Venkad000 Venkad000 commented Feb 9, 2026

SymUnmanagedExtensions.GetEmbeddedSource fails to decode embedded sources from Portable PDBs on big-endian architectures with System.IO.InvalidDataException: Found invalid data while decoding.

It could also be seen to fail on this test case on big-endian systems: Microsoft.CodeAnalysis.VisualBasic.UnitTests.PDB.PDBEmbeddedSourceTests.StandalonePdb.
Portable PDB embedded source blobs begin with a little-endian 32-bit uncompressed length, followed by compressed or raw data. BitConverter interprets values using the host architecture endianness. On big-endian systems this reverses the byte order, producing an invalid length and causing decompression to fail.

Comment thread src/Microsoft.DiaSymReader/Extensions/SymUnmanagedExtensions.Document.cs Outdated
Copy link
Copy Markdown
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

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

Please, simplify

@Venkad000 Venkad000 requested a review from tmat February 10, 2026 05:19
@tmat tmat merged commit c9e57ba into dotnet:main Feb 11, 2026
9 checks passed
@tmat
Copy link
Copy Markdown
Member

tmat commented Feb 11, 2026

Thanks for the fix!

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.

2 participants