Debugging an ApplicationĀ 

Because the ASP.NET Mobile Designer integrates into Microsoft Visual Studio, you can interactively debug your ASP.NET mobile Web applications by using source-level debugging capabilities in Visual Studio. The debugger requires specific settings for the programming language that you are using and the type of project that you are developing. These settings are configured automatically for you when you create a project. However, you might need to alter them occasionally. To learn more about the debugger settings for Microsoft Visual C# projects, see Project Settings for a C# Debug Configuration. For more information on debugger settings for Microsoft Visual Basic projects, refer to Project Settings for a Visual Basic Debug Configuration.

The process of debugging a mobile Web application is similar to that described in Debugging an ASP.NET Web Forms Application. The primary difference is that you will probably need to verify your application on a variety of hardware devices and emulators. For more information, see Working with Emulators and Browsers.

Note

Visual Studio does not currently support client-side breakpoints.

Debug Configuration Settings

This section describes the debug-related sections of an application configuration file (Web.config). For the most part, you will not need to change them. However, if you need to customize the debugging environment for your project, use the following information.

Dynamic Debug Compilation

Set compilation debug="true" to debug .aspx files. Set this value to false to improve the run-time performance of this application.

<compilation defaultlanguage="c#" debug="true" />

Custom Error Messages

You can specify a set of custom pages for errors. When an error occurs, Microsoft ASP.NET determines whether the application is configured to show custom errors, and whether an appropriate error page exists. If so, it redirects to the error page, passing a parameter that contains the original URL. For details, see <customErrors>.

If you configure your application to show custom errors, but there is no custom error page set up, ASP.NET sends the actual error to WML client devices. For custom error pages to work properly on WML devices, add the following code to the System.web section of Web.config.

<configuration>
    <system.web>
        <httpRuntime
            useFullyQualifiedRedirectUrl="true" 
        />
    </system.web>
</configuration>

Application-Level Trace Logging

Application-level tracing enables trace log output for every page within an application. Set trace enabled="true" to enable application trace logging. If pageOutput="true" is set, the trace information will be displayed at the bottom of each page. Note that when you use this debugging method, it is important to ensure that the default browser for Visual Studio is set to its internal browser. For more information, see Working with Emulators and Browsers.

If you need to browse your application with an emulator while you are tracing, set trace enabled = "true", as indicated previously. View the application trace log by browsing the file Trace.axd from your Web application root directory with Microsoft Internet Explorer.

<trace enabled="false" requestLimit="0" pageOutput="false" />
or
<trace enabled="true" requestLimit="40" pageOutput="true" />
traceMode="SortByTime" />

For further information, see <trace> and Enabling Application-level Tracing.

Note

For Visual C# projects, Unmanaged Debugging is on by default; for Visual Basic projects, Managed Only Debugging is on by default.

Note

You might need to modify the DEVPATH environment variable to include the path where the link libraries reside.

See Also

Concepts

Managing Adaptive Error Reporting in Mobile Web Applications
Compiling and Running an Application
Project Settings for C# and J# Debug Configurations
Project Settings for a Visual Basic Debug Configuration
Working with Emulators and Browsers

Other Resources

Customizing and Automating the Development Environment
Debugging ASP.NET Web Applications