Should I compile release builds with debug info as "full" or "pdb-only"?

RationalGeek picture RationalGeek · Oct 10, 2011 · Viewed 40.9k times · Source

In Visual Studio 2010 for a C# project, if you go to Project Properties > Build > Advanced > Debug Info you have three options: none, full, or pdb-only. Based on the answer to this question, I believe I understand some of the differences between full and pdb-only. However, which is more appropriate for a release build? If I use "full" will there be performance ramifications? If I use "pdb-only" will it be harder to debug production issues?

What is the difference between "full" and "pdbonly"? https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/debug-compiler-option

Answer

Matt Dillard picture Matt Dillard · Oct 10, 2011

I would build with pdb-only. You will not be able to attach a debugger to the released product, but if you get a crash dump, you can use Visual Studio or WinDBG to examine the stack traces and memory dumps at the time of the crash.

If you go with full rather than pdb-only, you'll get the same benefits, except that the executable can be attached directly to a debugger. You'll need to determine if this is reasonable given your product & customers.

Be sure to save the PDB files somewhere so that you can reference them when a crash report comes in. If you can set up a symbol server to store those debugging symbols, so much the better.

If you opt to build with none, you will have no recourse when there's a crash in the field. You won't be able to do any sort of after-the-fact examination of the crash, which could severely hamper your ability to track down the problem.

A note about performance:

Both John Robbins and Eric Lippert have written blog posts about the /debug flag, and they both indicate that this setting has zero performance impact. There is a separate /optimize flag which dictates whether the compiler should perform optimizations.