4.5. Errors and Debugging

Chapter 15 provides detailed information about testing and debugging ASP.NET AJAX applications, but this chapter on the AJAX Library would not be complete without a basic introduction to the debugging facilities. Debugging JavaScript can be quite challenging because of its dynamic interpreted nature. One of the reasons it is so difficult to debug is due to the fact that without being able to precompile JavaScript code, you often end up finding mistakes through runtime failures and errors. Further, runtime errors are not always helpful at assisting you identify the problem, although the extra debug mode messages are helpful.

It is important to note that Visual Studio 2008 now provides the ability to debug your JavaScript code directly in Visual Studio 2008. This allows you to step through your JavaScript code in the same manner as you step through your C# or Visual Basic code. Again, Chapter 15 covers this feature in more detail.

This next section shows you how to create your own debug trace window.

Figure 4-8. Figure 4-8
Figure 4-9. Figure 4-9

4.5.1. The Debug Trace Console

The Debug class makes tracking down issues easier. One of the facilities it supports is providing trace information from your code. You should always provide release and debug versions ...

Get Professional ASP.NET 3.5 AJAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.