Feature request - Embed source in PDB · Issue #5397 · dotnet/roslyn (original) (raw)
The PDB format has long had the capability to include the full text of source files, but most compilers have not made use of it. I would like to add an optional command line argument to the compiler to use this PDB feature.
Including the source gives the developer a way to transmit his code to anyone debugging it without requiring auxiliary mechanisms such as source control servers or saving source files on known file shares. Although it makes the PDB larger, in some cases this size gain might be preferable to overhead configuring those alternate mechanisms. Here are a few cases I imagine it might be useful:
- During the build, source code is auto-generated and then compiled. This auto-generated source does not exist on source control server and is often not preserved as a build artifact. Even if it is preserved, it can't be indexed on a symbol server making acquisition difficult at debug time. (This is my particular case)
- A company is OK from an IP standpoint to release source for some of their projects, but their source control system is behind a firewall. Their IT security policies prevent giving any external access to the source control system, which prevents typical usage of source server. They already provide PDBs to customers, and by including source in the PDBs the customer's debugging experience improves with minimal additional work.
- An Open Source project is doing all their development on GitHub and they current use source server to distribute source, but they don't like additional configuration necessary in VS to enable it. By distributing the source in the PDB they eliminate this additional configuration.
From my quick experiments, the work to enable such a feature is not very much. This is a simple prototype I've been working on to get a quick idea of the scope:
noahfalk@e4e20bf
To the best of my knowledge Visual Studio Debugger doesn't currently automatically use source embedded in PDBs, but I would collaborate with both teams to enable the debugging experience together with the compiler experience.
Please let me know what are the useful next steps. Thanks!