Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SourceLink returning incorrect PDB info #75959

Open
333fred opened this issue Nov 18, 2024 · 2 comments
Open

SourceLink returning incorrect PDB info #75959

333fred opened this issue Nov 18, 2024 · 2 comments
Assignees
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@333fred
Copy link
Member

333fred commented Nov 18, 2024

Version Used: 4.13.0-2.24561.3 (24e1dd6)

Steps to Reproduce:

  1. Paste this code into a .NET 9 template:
IEnumerable<string>? s = null;
  1. Make sure dotnet.navigation.navigateToSourceLinkAndEmbeddedSources is enabled in vscode. Or, if using vs, make sure sourcelink is enabled there.
  2. Go-to-def on IEnumerable

Expected Behavior:

SourceLink opens https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/IEnumerable.cs

Actual Behavior:

SourceLink opens https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/TypeUnloadedException.cs.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 18, 2024
@333fred 333fred added IDE-Project Project system and MSBuild interactions Area-IDE and removed Area-Compilers IDE-Project Project system and MSBuild interactions labels Nov 18, 2024
@dibarbet
Copy link
Member

dibarbet commented Nov 19, 2024

This issue appears to be specific to type definitions that are not an implementation, for example an interface like IEnumerable<T> or delegate Action<T>

Considering the attached DLL and PDB pair (see bottom of message)

  1. the typedef table (metadata) row 2624 has token 33557056
  2. the customdebuginformation (debug metadata) at row 948 has parent 33557056 (matching 1) - this entry has the comprressed integer that points to the TypeInitializationException document in the documents table (wrong)

Previously, non implementation types were not ever added to the Documents table at all. And this appears to be the case in this instance as well, IEnumerable.cs is not present.
Image

However - support for non implementation types in the documents table was added in #56278 (3 yrs ago),
so they should be in the documents table.

I think the next step is to see if the compiler is writing the correct output into the pdb (with both the item added to the documents table and the customdebuginformation pointing to it).

dllandpdb.zip

@davidwengier
Copy link
Contributor

I verified the compiler changes in #56278 seem to still be working fine:

A TypeDef for an inteface (02000003)
Image

Gets CustomDebugInformation record added for it
Image

and a Document record, which is pointed to by the value in the CustomDebugInformation:
Image

The System.Private.CoreLib.pdb has a CustomDebugInformation record for IEnumerable<T>, but not a Document record, which is odd given both were added in the same PR. I wonder if some part of the runtime build process strips out parts of a PDB, or combines parts of different PDBs, or something weird.

@stephentoub @tannergooding @jkoritzinsky do you know if the runtime build does anything interesting here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

3 participants