Deference between Debug and Release modeToday, I will try to explain the use of Debug mode and Release mode in Visual Studio.
There are two main phase in software development
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…