Wednesday, April 20, 2011

What is the key difference between a 'Debug' and a 'Release' build in .NET?

Duplicate of: Debug VS Release in .net

Why there are 'Debug' and 'Release' modes on build in dot net application?

What is the major technical difference between them?

From stackoverflow
  • Please see: Debug VS Release in .net

  • The Main difference as i understand is that in Debug Mode the whole symbol information which is used by the debugger is stored along with the progra, so that if a developer wants to debug the application before releasing he may do so, by attaching to any debugger. You might've noticed the .pdb files in the debug folder. Also the size of the executable is fairly larger. However in Release mode, the debugger symbol information is omitted assuming that the end user is going to use the application so he must not be provided with the application symbols.

    You can think of the symbols as the information proivided to the debugger to understand what local variables, what functions, where breakpoints are set and all sorts of information so that it can precisely tell you what part of code is being executed currently.

    morechilli : This is incorrect - debug symbols can be made available in both debug and release mode.
    morechilli : See http://stackoverflow.com/questions/218226/visual-c-2008-release-build-contains-debug-information
    Anirudh Goel : thanks i got that. I was going more from thinking the default configurations available in the project settings.
  • A short answer is that code built in 'Release' mode will be optimised for speed or size and also will have all the information used for debugging removed

  • Yeah right, you can even debug in release mode [:)]. there are elaborate processes to do it . However the release build is optimized for speed and performance. Also Micorsoft End user licence agreement states that you cannot deploy your debug files on a client system.

    http://www.codeproject.com/KB/debug/releasemode.aspx

  • Differences :

    • Debug inserts NOPs (No-operation CPU instructions) between useful IL code in order to allow debugger attachment
    • Debug does not allow various optimizations :
      • inlining (placing a method's code in place of a call to it in order to reduce call overhead)
      • loop unrolling (replacing a loop code - such as a for - with the repeated code to elliminate loop overhead (loop variable maintanence))

    And many others. Release is sensibly faster but offers no real debug support. For debugging there is... the debug mode :)

0 comments:

Post a Comment