/debug (C# Compiler Options)
The /debug option causes the compiler to generate debugging information and place it in the output file or files.
/debug[+ | -]
/debug:{full | pdbonly}
Use this option to create debug builds. If /debug, /debug+, or /debug:full is not specified, you will not be able to debug the output file of your program.
If you use /debug:full, be aware that there is some impact on the speed and size of JIT optimized code and a small impact on code quality with /debug:full. We recommend /debug:pdbonly or no PDB for generating release code.
Note
|
|---|
|
One difference between /debug:pdbonly and /debug:full is that with /debug:full the compiler emits a DebuggableAttribute, which is used to tell the JIT compiler that debug information is available. Therefore, you will get an error if your code contains the DebuggableAttribute set to false if you use /debug:full. |
For more information on how to configure the debug performance of an application, see Making an Image Easier to Debug.
To change the location of the .pdb file, see /pdb (C# Compiler Options).
To set this compiler option in the Visual Studio development environment
-
Open the project's Properties page.
-
Click the Build property page.
-
Click the Advanced button.
-
Modify the Debug Info property.
For information on how to set this compiler option programmatically, see DebugSymbols.
If you use /debug:full, be aware that there is some impact on the speed and size of JIT optimized code and a small impact on code quality with /debug:full. We recommend /debug:pdbonly or no PDB for generating release code.Eric Lippert has a blog post about this, titled "What does the optimize switch do?": http://blogs.msdn.com/b/ericlippert/archive/2009/06/11/what-does-the-optimize-switch-do.aspx
John Robbins has a blog post about this, titled "Do PDB Files Affect Performance?": http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/06/19/do-pdb-files-affect-performance.aspx
Both claim that "full" has no performance impact; to quote Mr. Lippert:
"Emitting debug information and optimizing the generated IL are orthogonal; they have no effect on each other at all"John Robbins specifically mentions that this documentation is wrong in one of the comments on the reference blog post: http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/06/19/do-pdb-files-affect-performance.aspx#9864
Can someone from Microsoft confirm this?
- 2/16/2012
- Matt Dillard
Note