views:

86

answers:

2

If I choose release mode to build a dll, is the stacktrace information still available?

If so, then what information is unavailable in release mode?

+2  A: 

If you are referring to stack traces in the context of Exceptions, then yes, stack trace information is still available in release mode. What you lose in release mode is full debug symbols, which provide source code sequence point information to stack traces. This allows the stack trace to identify the specific line of code that a particular stack trace entry refers to.

Additionally, in release mode with optimizations enabled, code may be inlined, changing how the runtime code is structured. While definitely more optimal, runtime release code has less of a relationship with the line of code that were actually written.

jrista
+3  A: 

You always have stack trace information--that's a runtime feature unrelated to the build mode--but line numbers and source file names are normally unavailable in release build stack traces.

You can get both line numbers and source file names in release build stack traces (including in exceptions) by altering the build configuration to create full program database (.pdb) files. To do so in Visual Studio:

  1. open your project's property pages
  2. select the Release configuration
  3. go to the Build tab, then click the Advanced button
  4. select "full" in the Debug Info dropdown.

Note that this will only help if the .pdb files are deployed alongside your application.

Ben M