User Id :    Password :      New Member   Forgot Password  
 
Deference between Debug and Release mode
Description Deference between Debug and Release mode   No. of Views     1315
  Rating     0
Author Gaurav   Posted On     19 Sep 2015
Tags ASP.NET 4.0,ASP.NET 4.5,ASP.NET 3.5,Visual Studio 2012,Visual Studio 2013,Visual Studio 2015    

Sample Code   Download Code

Today, I will try to explain the use of Debug mode and Release mode in Visual Studio. 

 


There are two main phase in software development
 

  • Development
  • Production
     

Both the phases are very important to deliver the software. At the time of development phase debug mode is important because developer want to know what is happening inside the code if there is any exception happen, so in this state debug mode is used.
 

While when project go for live (production) we are not interested in the tracking of the bugs, our main concern is only performance of the application, so in this state Release mode is used.
 

Debug Mode:


Debug allows developer to break the execution of the program. Some of the points related to debug mode are given below:
 

  • In Debug mode application size is big and its execution is slow because it has debug information inside it i.e. source code, variable name etc.
  • At run time consume more memory.
  • Code remains less optimized.
  • Developer can set break point at any code line.

 

Release Mode:

At the deployment of source code developer use Release mode. Some of the points related to Release mode are given below:
 

  • In Release mode application size is small that’s why execution of the application is fast, it does not have debug information.
  • Less memory consumption.
  • Code is more optimized.
  • Developer can’t set break point at every source code line.

 

Now, I would like to explain you these two modes by simple example. In Visual Studio write the below line of code in one console application

 

using System;

namespace DebugandRelease
{
    class Program
    {
        static void Main()
        {
            int i = 1;
            int j = 0;
            Add(i,j);
        }

        static public void Add(int p, int q)
        {
            Sub(p,q);
        }
        static public void Sub(int y,int z)
        {
            Multiply(y, z);
        }
        static public void Multiply(int g, int r)
        {
            Divide(g, r);
        }
        static public void Divide(int d, int h)
        {
            try
            {
                int m = d / h;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}



Now after this press ctrl + F5 by selecting debug in Visual Studio 
 

You can see that the developer can easily  check the complete stack in Debug mode first code run in Main method and then Add method and then Sub, Multiply and in last Divide in which exception comes.
 

 
 

 

And now select Release and then Press Ctrl + F5
 

In this you can see that only the final method display which fire the exception. So developer can’t see the complete stack in Release mode.




 

I hope you will like this article…

About Author

About Author I am as simple as c#. Gaurav
No Photo
 
Country India
Company N/A
Home Page N/A

Rate this article

Rating options from poor, fair, good, very good to excelent.  
 

Comments

   
Write your comment here.
Comment
Verification Code