Wednesday, April 11, 2007 10:00 AM
What is difference between debug and release? When I am compiling in debug mode, then how compiler knows it is debug mode or release mode. How compiler map break point in code line ( debug mode).
Wednesday, April 11, 2007 10:33 AMAFAIK debug and release executables (dll's, exe's, etc) are idenical to one another (unless you have #if DEBUG compiler directives in your code).
The big difference is that a debug compile generates .pdb files containing debugging information.
Wednesday, April 11, 2007 11:48 AM
There are also some other tiny differences between a Debug .Net Dll and a Release .Net Dll.
If you compile in debug (/debug+), the Debuggable attribute is added to the assembly.
To see the difference: use Il Dasm.exe=>Open=>Ctrl-M (View->MetaInfo->Show)=> section Assembly, in Debug a CustomAttribute of type System.Diagnostics.DebuggableAttribute is added. At run time, you can use GetCustomAttributes on your assembly.
Note: it is a good practice to keep the release and debug code similar, and not to have different behaviour, except extra (and slow) assertion.
Wednesday, April 11, 2007 12:29 PM
Debug and Release are different configurations for building your project.
You generally use the Debug mode for debugging your project, and the Release mode for the final build for end users.
The Debug mode does not optimize the binary it produces (as optimizations can greatly complicate debugging), and generates additional data to aid debugging.
The Release mode enables optimizations and generates less (or no) extra debug data.
After compiled to Assembly file (.dll or .exe), right-click the file and check its version property: Comments item is Dubug or Release.
You can append the following code to the AssemblyInfo.cs file:
Wednesday, April 11, 2007 12:30 PMModeratorIt is not well documented, here's what I know. The compiler emits an instance of the System.Diagnostics.DebuggableAttribute. In the debug version, the IsJitOptimizerEnabled property is True, in the release version it is False. You can see this attribute in the assembly manifest with ildasm.exe
The JIT compiler uses this attribute to disable optimizations that would make debugging difficult. The ones that move code around like loop-invariant hoisting. In selected cases, this can make a big difference in performance. Not usually though.
Mapping breakpoints to execution addresses is the job of the debugger. It uses the .pdb file and info generated by the JIT compiler that provides the IL instruction to code address mapping. If you would write your own debugger, you'd use ICorDebugCode::GetILToNativeMapping().
Tuesday, May 15, 2007 9:39 AMhi, i am new in this thing, and i have done a small windows forms programs and i use the default configuration to build in debug mode and now i am trying to run this program in another machine this doesn't run can anyone of you help me to solve this problem, please i am stuck in this two weeks ago ...... please
Wednesday, July 29, 2009 12:38 PM
In debug mode, many of the compiler optimizations are turned off which allow the generated executable match up with the code. This allows breakpoints to be set accurately and allows a programmer to step through the code one line at a time. Debugging information is also generated help the debugger figure out where it is in the source code.
In release mode, most of the compiler's optimizations are turned on. Chunks of your code could be completely deleted, removed, or rewritten. The resulting executable will most likely not match up with your written code. However, normally release mode will run faster then debug mode due to the optimizations.
- Proposed As Answer by queersane Monday, December 20, 2010 5:40 AM
Wednesday, May 04, 2011 2:33 AM
Public Sub getAssemblyMode()
If (Debugger.IsAttached) Then
sDebugMode = "Debug" '
bBreakOnError = True
sDebugMode = "Release"
bBreakOnError = False
Does it do the same thing?