C#/VB.NET Configuration - Do you know not to use debug compilation in production applications?
  v5.0 Posted at 18/07/2013 6:50 AM by Tiago Araujo

​Debug compilation considerably increases memory footprint since debug symbols are required to be loaded.

Additionally it will hit the performance because that will include the optional debug and trace statements in the output IL code.

In debug mode the compiler emits debug symbols for all variables and compiles the code as is. In release mode some optimizations are included:

  • unused variables do not get compiled at all
  • some loop variables are taken out of the loop by the compiler if they are proven to be invariants
  • code written under #debug directive is not included etc.

The rest is up to the JIT.

As per: C# debug vs release performance.

Figure: Bad Example
Figure: Good Example

We have a program called SSW Code Auditor to check for this rule.​

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address: