Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 35,875 times

Contents

Related Categories

High-Performance .NET Application Development & Architecture - Tracing

DMarko1

Tracing

Tracing in .NET is another means of debugging, but allows you to insert custom statements added to your page's output, whereby you can "trace" the flow of your code and determine the order of things at run time. Tracing, contrary to debug mode, presents you with a lot of information about your page. It further can help much in ascertaining any performance issues concerning your code. In any event, like debugging, tracing could be implement the same two ways:

  1. Application wide via the web.config file:

    <system.web>

    <trace enabled="true"/>

    </system.web>


  2. Or locally within each page's @ Page Directive:


    <%@ Page Trace="true" TraceMode="SortByTime | SortByCategory" %>


    And within your code you would trace by writing:

    Trace.Write("Tracing has started")

    Trace.Warn("Examine more closely here")

    Trace.Write("Tracing has ended")


    Trace. Write produces standard output, whereas using Trace.Warn would output your text in red for added notice. And bear in mind that the best place to Trace is usually before and after any major code sections, i.e. Datagrid binding, editing, etc.

With all this error handling now under our belt, what happens now when an error does occur? How do we fix it? Well, next we'll look at some common, though not basic, .NET system errors.

Dimitrios, or Jimmy as his friends call him, is a .NET developer/architect who specializes in Microsoft Technologies for creating high-performance and scalable data-driven enterprise Web and desktop applications. Till now Jimmy has authored nearly two dozen .NET articles, published on Dot Net Junkies, 4 Guys From Rolla, Sitepoint, MSDN Academic Alliance, Developers.NET, The Official Microsoft ASP.NET Site, and here on Developer Fusion, covering various unique and advanced techniques on .NET.

Comments