Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do debugging attributes such as [DebuggerDisplay] still get compiled into Release binaries?

Having recently learned of the DebuggerDisplay attribute, I've found it quite useful. However, one thing that surprises me is that it doesn't have a [ConditionalAttribute("DEBUG")] attribute attached to it. Is there some way to force this or is it a bad idea to try? Or does it not matter for some other reason?

like image 418
MighMoS Avatar asked Jul 08 '09 18:07

MighMoS


People also ask

Can you debug in release mode?

You can now debug your release build application. To find a problem, step through the code (or use Just-In-Time debugging) until you find where the failure occurs, and then determine the incorrect parameters or code.

What is the difference between release and debug in Visual Studio?

Visual Studio projects have separate release and debug configurations for your program. You build the debug version for debugging and the release version for the final release distribution. In debug configuration, your program compiles with full symbolic debug information and no optimization.

What is debug and release build?

Debug mode and Release mode are different configurations for building your . Net project. Programmers generally use the Debug mode for debugging step by step their . Net project and select the Release mode for the final build of Assembly file (. dll or .exe).

Which of the following attributes can be used to assist with debugging C# code?

Use the DebuggerTypeProxyAttribute attribute when you need to significantly and fundamentally change the debugging view of a type, but not change the type itself.


1 Answers

The [ConditionalAttribute("DEBUG")] is only used for optimising out method calls.

If you really want to remove these from your builds you can use #ifdef so that the code is only compiled in release mode.

One thing to bear in mind is that you can still debug binaries in release mode, as long as you have the pdb files it shouldn't matter. Release mode just clears up variables sooner and applies some compiler optimisations

like image 179
Matthew Steeples Avatar answered Oct 02 '22 15:10

Matthew Steeples