Search code examples
c#.netpdb-files

How to read source path from pdb


How can you read the source paths used to compile a pdb in .NET (C#) environment?


Solution

  • The PDB format is NOT documented - but there is an API from MS called DIA which provides several methods to deal PDB. It is COM-based... for details see MSDN. PDB files usually contain filenames and linenumbers BUT I am not sure that they always contains full path to the source.

    Some interesting information on PDBs can be found here.

    IF you want some .NET source code dealing with .PDBs see Mono.Cecil and esp. the namespace Mono.Cecil.Pdb .

    2/12/16 update

    Microsoft has been open-sourcing the PDB format. Information can be found in their github repo here.