Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Dlls compiled in debug mode should stay in the developmental environment while they're being debugged, improved, stepped-through, and tweaked.
When the dll is ready to be deployed (released) to a high-traffic server—such as a SharePoint TEST, QA, or Production Farm—the dll should be recompiled in release mode.
When in debug mode. . .
- Expect the memory footprint of the process to be enlarged since debug symbols are required to be loaded.
- Expect a substantial performance hit due to the debug and trace statements (System.Diagnostics.DebuggableAttribute) in the output IL code. In debug mode there are several extra instructions added to enable you to set a breakpoint on every source code line a debugger such as Visual Studio.
- Also the code will not be optimized by the compiler. JIT optimizations will be disabled. (IsJitOptimizerEnabled)
In release mode. . .
- all calls to Debug class methods in your code are disabled.
- Code is optimized during the build operation
- You cannot take advantage of any source-code level debugging tools. You cannot set breakpoints.
- Better performance
- Smaller memory footprint
Comments
- Anonymous
June 04, 2014
Actually you can use breakpoints in Release. And you should have debug symbols for Release too. - Anonymous
June 04, 2014
@Lucian - symbols can be generated in release for debugging, but why would you want them to be? By that point your code should be tested (code/integration/regression) and any logging you require to trace bugs should be done separately. Past a staging environment you shouldn't be debugging production code, depending on your project (for example MVC - using a remote debugger and putting break points in controllers) you could be affecting all traffic to your site, not just your requests. On large deployed systems this would be a big no (can't see Facebook doing that). If your needing to debug live code its probably highlighting mistakes in the rest of your release process. - Anonymous
June 04, 2014
The comment has been removed - Anonymous
June 04, 2014
Totally agree with @Dzejms and @Lucian, production symbols may save your life, especially if you have to dump your process for examination inside WinDbg. - Anonymous
June 05, 2014
Great discussion. Thanks for the comments!