2.8.08

.Net Debugging and tracing

Question - What is break mode? What are the options to step through code?
Answer - Break mode lets you to observe code line to line in order to locate error.VS.NET provides following option to step through code.Step Into Step Over Step Out Run To Cursor Set Next Statement
Question - Debug Vs Trace.
Answer - Both these objects are found in the System.Diagnostics namespace. Both are used for diagnose problems without interrupting application execution. Debug statement can only be used in debug mode while trace statement can be used both in debug and released mode.Debug statements can't be compiled into a release version.
Question - Define trace class.
Answer - The trace class in the code is used to diagnose problem. You can use trace messages to your project to monitor events in the released version of the application.The trace class is found in the System.Diagnostics namespace.
Question - Define Listeners collection of Trace and Debug objects.
Answer - The Trace and Debug objects contain a Listeners collection. These Listeners collection collect output from the trace statements. There are three types of predefined listeners: DefaultTraceListenerTextWriterTraceListenerEventLogTraceListener
DefaultTraceListener: This is default listener and writes trace statements in the Output window. TextWriterTraceListener: can write output to the text file or to the console window. EventLogTraceListener: can write messages to the Event Log.
Question - Define Trace Switches.
Answer - Trace switches are used to configure tracing behavior. There are two kinds of trace switches: BooleanSwitch and TraceSwitch. BooleanSwitch: It is either on or off. TraceSwitch : It has property to determine trace behaviour. Trace switches can be configured through application's .config file even after the application is compiled.

No comments: