Coder Perfect

What is a PDB file, exactly?

Problem

What is a PDB file, and how can I keep it out of my solution’s release folder when I rebuild it?

Asked by Ata

Solution #1

A PDB file is a collection of data that the debugger can use. In any case, a Release build contains less information than a Debug build. However, if you don’t want it to be generated at all, go to your project’s Build options, choose the Release configuration, click “Advanced…”, and select “None” under “Debug Info.”

Answered by Jon Skeet

Solution #2

I had originally asked myself, “Do I need a PDB file deployed to my customer’s machine?” and had opted to leave it out after reading this post.

Everything was well until today, when I was trying to figure out why a message box with an Exception was appearing. The file and line number information was missing from StackTrace, which was required for diagnosing the issue. The significant nugget of information I discovered after re-reading this post is that, while the PDB is not required for the app to operate, the file and line numbers must be present in the StackTrace string. All is well now that I included the PDB file in the executable folder.

Answered by BCA

Solution #3

The term PDB stands for Program-Debug Data Base. It’s a repository (permanent storage, such as databases) storing information needed to run your application in debug mode, as the name implies. It offers a wealth of information that you’ll need to debug your code (in Visual Studio), such as where you’ve placed break points in Visual Studio where you expect the debugger to break.

If you remove the *.pdb files from the debug directory, Visual Studio will fail to hit the break points. In a stack trace, the Visual Studio debugger can also tell you the specific line number of the code file where an exception occurred. It can only do so with the use of *.pdb files. As a result, PDB files are extremely useful for debugging.

It is not suggested to prevent the creation of *.pdb files in general. From the standpoint of a production release, you should construct the PDB files but not send them to the customer’s site via the product installation. All created PDB files should be saved on a symbol server so that they can be used/referenced in the future if needed.

It is specially important in scenario where you debug process crash issues. While analysing the crash dump files if the original *.pdb files created during the build process are not preserved then Visual Studio will not be able to make out the exact line of code which is causing crash.

If you still wish to prevent the creation of *.pdb files for any release, navigate to the project’s properties -> Build Tab -> Advanced button -> None from the “Debug Info” drop-down box -> OK, as shown in the screenshot below.

Note: For “Debug” and “Release” build settings, this option must be done individually.

Answered by RBT

Solution #4

The debugger reads information from a PDB file. It is not required to run your program, and it is not essential to be included in the final version.

In Visual Studio, you can turn off the creation of pdb files. If you’re building using a script or the command line, you can skip the /Debug switch.

Answered by Mark Byers

Solution #5

The Program Debug Database file (pdb) is a Microsoft file type for storing debugging data.

These symbol files are created by the compiler when you build a project with Visual Studio or the command prompt.

Check Microsoft Docs

Answered by Nipuna

Post is based on https://stackoverflow.com/questions/3899573/what-is-a-pdb-file