Skip to content

Preserve document custom debug information#495

Merged
sbomer merged 2 commits into
dotnet:mainfrom
sbomer:cecil-sourcelink-fix
Jul 24, 2026
Merged

Preserve document custom debug information#495
sbomer merged 2 commits into
dotnet:mainfrom
sbomer:cecil-sourcelink-fix

Conversation

@sbomer

@sbomer sbomer commented Jul 23, 2026

Copy link
Copy Markdown
Member

Fixes dotnet/runtime#115145.

Portable PDB documents are preserved even when they are no longer referenced by sequence points, but their custom debug information was only loaded when resolving a referenced document. Consequently, documents left unreferenced after trimming could be written without records such as EmbeddedSource.

Before writing the complete document collection, load custom debug information for documents that have not already been resolved. This keeps read-only PDB usage lazy while ensuring all document records are preserved during a rewrite. Embedded-source content remains lazy and is copied from its original raw blob when written.

The regression test removes the entry point and types containing a document’s sequence points without first accessing their debug information, writes the module, and verifies the output PDB still contains that document’s embedded source.

Testing

  • dotnet test Test/Mono.Cecil.Tests.csproj --filter FullyQualifiedName~PortablePdbTests (36 passed)
  • dotnet test Test/Mono.Cecil.Tests.csproj (355 passed, 3 skipped)

Note

This content was created with assistance from AI.

sbomer and others added 2 commits July 23, 2026 14:26
Load custom debug information for every preserved portable PDB document so embedded sources survive a round trip.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 01ec6ff9-132e-45df-95c2-9cedbce405cb
Assisted-by: GitHub Copilot CLI:GPT-5.6-Sol [code-review]
Read missing document custom debug information only when producing a portable PDB, and verify embedded sources survive after their sequence points are trimmed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 01ec6ff9-132e-45df-95c2-9cedbce405cb
Assisted-by: GitHub Copilot CLI:GPT-5.6-Sol [code-review]
@sbomer
sbomer merged commit 74999f2 into dotnet:main Jul 24, 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.

ILLink removes embedded sources

2 participants