Comment unsuccessful. Please correct the errors below.
Debug vs Release Mode and the NOP Instruction
May 22
2012
Ok! After a long rest, I am back again. I have been reading a lot and so it's time to talk about some them.
In the recent past, I found that many developers (including me) will complain about the presence of the so called mysterious "NOP" instruction in the .NET assembly code.
The other day I tried to have a look into this and found that "NOP" instruction is an instruction related to the debuggers.
How to justify the same. So I created a simple program and compiled the code in both Debug and Release modes in Visual Studio.
The Simple code I used for the demonstation using a Windows Console Application looks like :
Now I have two version of the output of the Program. If we take a look at the assemblies in ILDASM.
(To open ILDASM : Start(Windows key) -> All Programs -> Microsoft Visual Studio 2010 -> Microsoft Windows SDK Tools -> IL Disassembler)
Double click the main method and have a look at the IL code emitted by the compiler. When you compare both the Debug and release version of the files, you will find the NOP instructions in the Debug version of the executable.
So here you saw the slight difference in the assembly instructions for Debug and Release mode of an .NET executable/assembly.

Now I have two version of the output of the Program. If we take a look at the assemblies in ILDASM.
(To open ILDASM : Start(Windows key) -> All Programs -> Microsoft Visual Studio 2010 -> Microsoft Windows SDK Tools -> IL Disassembler)

Double click the main method and have a look at the IL code emitted by the compiler. When you compare both the Debug and release version of the files, you will find the NOP instructions in the Debug version of the executable.

So here you saw the slight difference in the assembly instructions for Debug and Release mode of an .NET executable/assembly.
No new comments are allowed on this post.
Comments
No comments yet. Be the first!