DEBUG CLASS
- Namespace System.Diagnostics
- Provides a set of methods and properties that help in debugging the code
- This class can not be inherited, i.e it is sealed
- This class provides methods to display an Assert dialog box, and to emit an assertion that will always fail
- Provides write methods in various flavors like Write, WriteLine, WriteIf, WriteLineIf
- To enable debugging in C#, add the /d:DEBUG flag to the compiler command line
- or, add #define DEBUG to the top of the code file
- Debug is DISABLED in release builds by default, so no executable code is generated for Debug methods
TRACE CLASS
- Namespace System.Diagnostics
- Provides a set of methods and properties that help in tracing the execution of the code
- Methods and properties of Trace class can be used to monitor the health of an application running in real-life settings
- Tracing helps in isolating problems and fixing them without disturbing a running system
- To enable Tracing in C#, add the /d:TRACE flag to the compiler command line
- or, add #define TRACE to the top of the code file
- In VS2005 trace is ENABLED by default. Therefore, code is generated for all Trace methods in both release and debug builds
- To set the AutoFlush and IndentSize in Web.Config, specify trace settings as under:
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="3">
</system.diagnostics>
</configuration>
No comments:
Post a Comment