Both Debug and Trace use System.Diagnostics
namespace.
Debug
- It uses Debug class.
- It uses in debug build.
- It uses the time of application
development.
- In Debug mode compiler inserts some
debugging code inside the executable.
- Debug class works only in debug mode.
- Performance analysis cannot be done using
Debug.
- Debugging uses to find error in program.
- For Debug we can use Debug.Write()
method.
- Debug runs in same thread as main program
execute.
Trace
- It uses Trace class.
- Trace statement includes by default when
program compiled into released build.
- Trace class is used for testing and
optimization even after an application is compiled and released.
- Trace class works in both case Debug mode
as well as release mode.
- Trace runs in different thread form main
program execute thread.
- For Trace we can use Trace.Write()
method.
- It uses time of application deployment.