1

I notice a few other stack overflow questions about this but none seem to really address what I am trying to find out.

I have been running in "debug" mode when developing but now I notice that when I switch to "release" mode in the "Solution Configurations" I am still able to set breakpoints and look at the value of variables.

I was told "debug" mode is very slow. Can someone explain what is the advantage of setting my solution configuration (top menu drop down) to "debug"? What additional debug capabilities does it give me?

2 Answers2

2

Most notable: The Debug configuration will contain line numbers in stack traces.

However, there is more: The compiler will not optimize or inline your code, which "could" impact the performance. In general it is not recommended to deploy debug builds.

And you can add compiler directives, since (by default) the DEBUG constant is defined:

public void Method()
{
    #if DEBUG
        log("Method invoked");
    #end if
    ...
}
Jürgen Steinblock
  • 30,746
  • 24
  • 119
  • 189
  • I was told "debug" mode would be slower. Is this your experience also? Would it be slower to start up the application as well as slower when running ? –  Mar 31 '14 at 06:54
  • 1
    It really depends on your solution and what code you are runnung. If you are just working with third party (or framework) code, the impact is very low. For example an entity framework driven database application for CRUD operations: Most "heavy" work and time spend is done outside your own code and is not impacted. However I would't deploy a Mandelbrot application as DEBUG. I would suggest: Deploy Release for customers and Debug to testers (beta) – Jürgen Steinblock Mar 31 '14 at 07:01
2

Directly from Microsoft:

  • The Debug configuration of your program is compiled with full symbolic debug information and no optimization. Optimization complicates debugging, because the relationship between source code and generated instructions is more complex.

  • The Release configuration of your program contains no symbolic debug information and is fully optimized. Debug information can be generated in PDB Files, depending on the compiler options that are used. Creating PDB files can be very useful if you later have to debug your release version.

Programs running in Debug mode may be somewhat slower due to the lack of optimization. However, you would not distribute a Debug version of your application, so speed is generally not a huge factor. You only have access to breakpoints because a .pdb file is generated in release mode, but if you were to remove the .pdb files, you would no longer be able to set breakpoints. Also, due to optimization, there could be some areas of code where breakpoints would not work.

Claies
  • 22,124
  • 4
  • 53
  • 77