Debugging ASP.NET AJAX with Visual Studio 2005 and Vista
The problem is you can’t add breakpoint in your Js code “This is not a valid location for a breakpoint.” on VS 2005 unless you move it to an external Js file.
Dan Walhin made a good video tutorial where he shows us every steps needed to debug client side script :
Basically, you have to tweak IE to enable client script debugging :
Go to Tools > Internet Options > Advanced and uncheck both “Disable script debugging (Internet Explorer)” and “Disable script debugging (Other)” .
Then in your client code use debug.fail() Microsoft AJAX method to launch debugging, and as you have the message “There is no source code available for the current location“, use the Script Explorer window (Debug > Windows > Script Explorer) to get a list of all loaded Js scripts, then you can select one, debug and step-in your client code and also into the AJAX Framework!
But… no way for me to make it work with Visual Studio 2005 on Vista (and file system web app) !
So if you are stuck like me maybe you’ll need to do more work :
You also need to start Visual Studio 2005 with admin privilege (right click VS shortcut “Run as administrator”).
Chances are now you’ll be able to hit F5 and step through your client code in VS (if not go to the link at the end of this post).
Later I found a very good article from Mike Volodarsky which describe a lot more on the subject, specially if you are using IIS :