Motivatio
- Issues with building & debugging ASP.NET Ajax Extension sites
- Visual Studio
- Browser tools
- Helper utilities
- Tracing tools
- Modifying requests, analyzing responses
- Writing trace messages
- Assert/Fail
- The big ‘A’ in Ajax makes debugging tricky as deterministic behavior is elusive
- The request/response nature of Ajax applications means tracing data is necessary for debugging. This requires some trace mechanism (not just the browser and IDE)
- Dynamic typing means code is often harder to understand and predict —and the loss of compiler validation complicates things
Why is debugging Ajax apps so hard?
- Asynchrony
- The big ‘A’ in Ajax makes debugging tricky as deterministic behavior is elusive
- Data flow
- The request/response nature of Ajax applications means tracing data is necessary for debugging. This requires some trace mechanism (not just the browser and IDE)
- Dynamic typing
- Dynamic typing means code is often harder to understand and predict —and the loss of compiler validation complicates things
Debugging in Visual Studio 2008
- In the past, debugging JavaScript has been problematic…
JavaScript debugging in VS 2005
- Support for debugging in Visual Studio 2005 is not as seamless:
- Enable script debugging in IE
- Add debuggerkeyword in source to trigger breakpoints
- Start debugging (F5)
Script exploration in VS 2005
- Visual Studio 2005 also includes a script explorer
- Enable script debugging in IE
- Start debugging (F5)
- Debug menu | Other Windows | Script Explorer
- Double-click to open scripts
- You can set breakpoints & debug as usual
- if command doesn't appear, select Tools | Customize | Debug, then drag Script Explorer command to the menu…
Firefox JavaScript Debugging
- Firefox has built-in support for JavaScript debugging & DOM inspection
- Tools | Error/JavaScript Console
- Tools | DOM Inspector
- Many extensions also available
Firefox JavaScript Console
Firefox DOM Inspector
Firebug script debugger
- Firebug is an extension for Firefox
- Monitors script errors & signals when there is a problem
- Tracking of XMLHttpRequests
- Script debugger with breakpoints
- Inspector / command line
- Source viewer
Web Development Helper
- IE browser extension
- Localhostdiagnostics including ViewStatedisplay, items in cache, application shutdown
- HTTP logging
- DOM inspector
- Rich script error information
ASP.NET Development Helper
Summary
- ASP.NET AJAX Extensions simplify building AJAX-enabled sites
- However, debugging is trickier than traditional POST-back sites
- Asynchronous nature of Ajax
- Dynamic nature of JavaScript
- Visual Studio 2008 offers good support for JavaScript debugging
- Use additional tools for tracing & testing
- Multitude of tools available for IE and Firefox...
No comments:
Post a Comment