tags:

views:

1935

answers:

6

Continuation to my previous question is any one aware of a comprehensive document what list all available differences between debug and release modes in C# application , and particularly in web application ?

What differences you aware of ?

+4  A: 

i'm not aware of one concise document, but:

  • Debug.Write calls are stripped out in Release
  • In Release, your CallStack may look a bit "strange" due to optimizations, as outlined by Scott Hanselman
Michael Stum
+2  A: 

Drawing with GDI+ is considerably slower in Debug mode.

Hallgrim
+1  A: 

Release version:

  1. is considerable faster (most important), optimized

  2. can't be debuged (step by step)

  3. code written in "debug" directive is not included

http://haacked.com/archive/2004/02/14/difference-between-debug-vs-release-build.aspx

Dani
+11  A: 

"Debug" and "Release" are just names for predefined project configurations defined by Visual Studio.
To see the differences, look at the Build Tab in Project Properties in Visual Studio.

The differences in VS2005 include:

  • DEBUG constant defined in Debug configuration

  • Optimize code enabled in Release configuration

as well as other differences you can see by clicking on the "Advanced" button

But you can:

  • Change the build settings for Debug and Release configurations in Project Propeties / Build

  • Create your own custom configurations by right-clicking on the solution in Solution Explorer and selecting Configuration Manager

I think the behaviour of the DEBUG constant is fairly clear (can be referenced in the #if preprocessor directive or in the ConditionalAttribute). But I'm not aware of any comprehensive documentation on exactly what optimizations are enabled - in fact I suspect Microsoft would want to be free to enhance their optimizer without notice

Joe
This answer is correct but superficial, i wanted to know more details about how code will behave code optimization is used and DEBUG constant is used. There a lot of differences in how code will behave , you can see my previous question for an example
MichaelT
Sorry if this isn't helpful. I suggest you modify your question in order to get a better answer. I think the behaviour of the DEBUG constant is fairly clear (can be referenced in the #if preprocessor directive or in the ConditionalAttribute) (contd...)
Joe
... (cont'd to get over 300c limit). But I'm not aware of any comprehensive documentation on exactly what optimizations are enabled - in fact I suspect Microsoft would want to be free to enhance their optimizer without notice.
Joe
@Joe...you should throw these comments into the answer...especially the last part of the second one. Sure, you can empirically figure out what is slower or faster, but it *could change at any time*. +1.
Beska
@Beska, thx, will do.
Joe
+2  A: 

One major performanance area if you are using any of the asp.net ajax controls: debug info is removed from the javascript library when running in release and I have seen major preformance improvements on complicated pages. Other web based resources may be either cached or not cached based on this setting.

Also, remember that Debug / Release in a web application is dictated by the web.config file, not your settings within Visual Studio.

<system.web>
    <compilation debug="true">

More info:

http://msdn.microsoft.com/en-us/library/s10awwz0.aspx

http://weblogs.asp.net/scottgu/archive/2006/04/11/Don_1920_t-run-production-ASP.NET-Applications-with-debug_3D001D20_true_1D20_-enabled.aspx

Andrew Robinson
+4  A: 

There isn't one document that lists the differences. In addition to some of the differences already listed, compiling in Debug mode turns off most of the JIT compiler optimizations that are performed at runtime and also emits more complete debug information in to the symbol database file (.pdb).

Another big difference is that the GC behavior is somewhat different in that the JIT compiler will insert calls to GC.KeepAlive() as appropriate/needed in order to support debugging sessions.

Scott Dorman