Skip to content

Preserve document custom debug information - #981

Open
sbomer wants to merge 1 commit into
jbevain:masterfrom
sbomer:cecil-sourcelink-fix-jbevain
Open

Preserve document custom debug information#981
sbomer wants to merge 1 commit into
jbevain:masterfrom
sbomer:cecil-sourcelink-fix-jbevain

Conversation

@sbomer

@sbomer sbomer commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Fixes dotnet/runtime#115145.

This ports dotnet#495 to the upstream repository.

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 -f net8.0 --filter FullyQualifiedName~PortablePdbTests (36 passed)

Note

This content was created with assistance from AI.

* Preserve document custom debug information

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]

* Hydrate document debug information when writing

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]

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 01ec6ff9-132e-45df-95c2-9cedbce405cb
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

1 participant