Archives

Archives / 2010 / April
  • How to enable tracing in ASP Classic Compiler

    With the build 0.6.2, we added the option to enable tracing. The tracing can be enabled by setting the following in the global.asax.cs file:

    using Dlrsoft.Asp;
    AspHandlerConfiguration.Trace = true;

    Setting this option will tell the compiler to inject line number into the compiled code. If the compiled code throws any runtime error, the exception will contain the source file name and line number.

    If you would like to receive the complete trace history, you will have to configure a trace listener. VBScript.net compiler uses TraceSource “Dlrsoft.VBScript”. The following is an example configuration section in the web.config file:

    <system.diagnostics>
      <trace autoflush="true">
        <listeners>
        </listeners>
      </trace>
      <sources>
        <source name="Dlrsoft.VBScript"
          switchName="vbscriptSwitch"
          switchType="System.Diagnostics.SourceSwitch">
          <listeners>
          </listeners>
        </source>
      </sources>
      <switches>
        <add name="vbscriptSwitch" value="Verbose"/>
      </switches>
    </system.diagnostics>

    The above configuration will send the trace information to DefaultListener. You can see the trace output using DebugView. You might also route the trace output to ASP.NET tracing using the WebPageTraceListener. Please see this post for more information regarding tracing.

    Please note that enable tracing itself only adds a small overhead to the Asp Classic Compiler. However, some listeners can add a huge overhead.