Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,16 @@ public override void VisitDebugHeader (DebugHeader dbgHeader)
dbgHeader.Age = old.Age;
dbgHeader.Characteristics = old.Characteristics;
dbgHeader.FileName = old.FileName;
dbgHeader.MajorVersion = old.MajorVersion;
dbgHeader.MinorVersion = old.MinorVersion;
dbgHeader.Signature = old.Signature;
dbgHeader.TimeDateStamp = ImageInitializer.TimeDateStampFromEpoch();
// Portable PDBs (CodeView MinorVersion magic 0x504D) encode a content-derived stamp that
// is part of the PDB identity. Preserve it so the rewritten image keeps matching its
// unmodified PDB (IsPortableCodeView stays true and symbolication still works). Other

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.

@lateralusX so we don't touch the PDB at all in ILStrip? I think we do in ILLink

@lateralusX lateralusX Jul 31, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ILStrip don't touch the PDB it's just removing things from the assembly. ILLink rewrites the PDB (since it drops tokens and metadata), but the timestamp is not a timestamp but a hash for portable PDB's, it must be synced with the updated PDB in the updated assembly. ILLink goes through another cecil that handle that part correct, it recreates the new PDB and assembly together making sure fields align and since the issue only reproduce when running ILStrip, not ILLink, this is an ILStrip isolated issue.

// debug entry kinds retain the historical behavior of a freshly generated stamp.
dbgHeader.TimeDateStamp = old.MinorVersion == 0x504D
? old.TimeDateStamp
: ImageInitializer.TimeDateStampFromEpoch();
dbgHeader.Type = old.Type;
}

Expand Down