Debug vs. Release Build

B

Bob Johnson

It is my understanding - and please correct me if I'm wrong - that when
building a project in debug mode, I can deploy the .pdb file along with the
..exe and thereby have access to the specific line number of code that throws
an exception. Specifically, I can have an error logging routine that,
amongst other things parses the call stack and tells me the specific line of
code that choked.

It is also my understanding that if building in Release mode that I won't
get the .pdb file and/or have programmatic knowledge of the specific line of
code that threw an exception.

If the above is true, then that would seem to be a big advantage of building
in debug mode and putting that into production - rather than building in
release mode.

What do you think?

I'm looking for reasons to build in "Release mode" but can't seem to get
past the fact that I lose the knowledge of which line of code choked.

I would appreciate your perspective on this... and what is different about
building as Release vs. Debug.
 
G

Guest

Never ever put debug builds into production. Your build process should emit
release builds, so all system testing is on production code.

You CAN create pdbs for release builds; in VS 2005, go to project
properties, Build, set the Configuration to Release, click Advanced, and set
Debug Info to pdb-only (not the default). Microsoft recommend not using full
info for release builds, as this impacts size, performance and code quality,
whereas pdb-only does not.

However you do not need a pdb to find out where an exception occurred - just
log Exception.ToString(), which includes the stack trace.

The pdb is useful if you want to debug the production system, e.g., attach a
debugger to the running process (requires full info), or debug a crash dump.
You can do this using windbg, part of the Microsoft Debugging Tools for
Windows.
 
M

Mark Rae [MVP]

However you do not need a pdb to find out where an exception occurred -
just
log Exception.ToString(), which includes the stack trace.

But if you do deploy the pdb file, you will get much more detailed
information about the exception, even down to the number of the line which
threw it...
 
C

Chris Mullins [MVP - C#]

We've been deploying Release builds with PDB files for years now. It's just
an option in Visual Studio, and it's also easily set using MSBuild or NAnt.

Without the ability to do this, we would be screwed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top