Vishful thinking…

Debugging embedded JavaScript files in Visual Studio

Posted in Uncategorized by viswaug on March 25, 2008

The credit for this post goes to Rachel who recently informed me how to debug and step through embedded JavaScript files in Visual Studio when using IE. Before today, whenever I had to debug through embedded JavaScript files I resorted to using FireFox even though the application I was building needed to be delivered on IE. What is an embedded JavaScript file? These are the JavaScript files that are embedded inside assemblies and retrieved by the web server using the WebResource.axd handler. Anyway, I have been using them extensively when developing custom tasks (ASP.NET server controls) for the ArcGIS Server .NET ADF. This way all the dependencies for the server controls are contained right within the server control assembly and now the server control can be easily redistributed and used by clients by a simple drag and drop.

The Solution, a “hidden” feature in Visual Studio called the “Script Explorer”.

In visual studio, right click anywhere and toolbar, Customize > Commands Tab > Debug Category > Drag and drop Script Explorer. It is greyed out unless you are in debug mode. In IE, open options, make sure you’ve enabled script debugging. Start debugging your web application, while running, click on script explorer window.  you’ll see all the URL’s to the embedded resources, double click them to bring them up in VS window. You should see the embedded JS code, set breakpoints, mouse over as desired.