You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
System.Reflection.Metadata: BlobBuilder.LinkSuffix loses pre-linked content when destination is empty #127243
This issue body was drafted with assistance from GitHub Copilot.
Description
BlobBuilder.LinkSuffix appears to drop previously linked content when the destination builder is empty and the suffix builder already has a linked suffix.
Minimal repro
usingSystem;usingSystem.Reflection.Metadata;staticstringHex(byte[]bytes)=>BitConverter.ToString(bytes);varemptyPrefix=newBlobBuilder(16);varelement=newBlobBuilder(16);vartail=newBlobBuilder(16);element.WriteByte(0x11);tail.WriteByte(0x22);// Pre-link element + tailelement.LinkSuffix(tail);// Then link into empty destinationemptyPrefix.LinkSuffix(element);Console.WriteLine(Hex(emptyPrefix.ToArray()));
Actual behavior
Output:
22-00
Expected behavior
Output should preserve both bytes in order:
11-22
Notes
A control case with a non-empty destination (prefix.WriteByte(0xAA) before linking) behaves as expected. The issue reproduces specifically when the destination BlobBuilder is empty.
Observed in local repro project targeting net11.0 in this repository.
Activity
dotnet-policy-service commentedon Apr 21, 2026
Tagging subscribers to this area: @dotnet/area-system-reflection-metadata
See info in area-owners.md if you want to be subscribed.