Wednesday, 21 November 2007

chapter 10, lesson 2: debugging and tracing.

Debug, Debugger classes - more efficient than stepping through code - less time consuming.

Debugger Class
  • enables comm with a debugger app.
  • Break() - equiv of setting bk'pt manually.
  • Log() - posts info to the attached Debugger, if present. To listener objs attached to debugger.
  • Listener - DefaultTraceListener - take Log mthds and write as text to specified target.

Debug Class

  • more granularity than Debugger.
  • Assert() - for true/false conditions - if condition isn't true it will break into the debugger automatically.
  • in release build no debug commands are compiled in so no perf degredation.
  • Fail() - doesn't use an evaluation - simply breaks at offending line and outputs failure msg.
  • Write(), WriteIf()...

Debug Attributes

  • DebuggerBrowsable attr - [DebuggerBrowsable(DebuggerBrowsableState.Never)]
  • DebuggerDisplay - configure top line for class in Locals window.
  • DebuggerHidden - stops bk'pt being set inside anything it decorates.

No comments: