Updates from QA Training

Javascript Debugging in Visual Studio

A little segue from my JavaScript debugging to consider my .NET chums and show you how to set up javascript debugging in Visual Studio.


David Walker | 28 June 2012

A little segue from my JavaScript debugging to consider my .NET chums and show you how to set up javascript debugging in Visual Studio.

I was asked today can you debug JavaScript in Visual Studio. The answer is yes, and if you are used to the debug functionality of Visual Studio it is a great boon to do so. With it we can ad watches, breakpoints, examine the stack trace and fallow a breakpoint from JavaScript client through to C# WCF call and back again stepping seamlessly from client to server breakpoint.

To set it up we need to do the following:

Part 1 - Configuring IE

IE has to be your default browser. Switch it back later if you want but without it every other step will not work.

  • Open IE and choose Internet options (on most browsers done by clicking on the cog Icon at the right of the screen).
  • Chose the Advanced tab and within find the Browsing section and uncheck the Disable both Script debugging options.

  • Apply your changes

Part2 - Setting up a project to allow debugging

  • Within the web.config file you must have debug enabled it is false by default so check if the following code is setup:

                                  <compilation debug="true"/>

  • As a note you want to put this back to false for product release.
  • Now open a page with some javascript in and click to add a breakpoint as you always do.
  • Then run the page in debug mode by pressing F5
  • When IE hits the script it will pass the captured debug back to Visual Studio. Very usefully you can step through or jump on to other breakpoints even if the Breakpoints are in server and not client code.

David-Walker---sq

David Walker

Head of Emerging Technologies

David is a change driven technologist who continually looks to adapt and expand his knowledge and understanding of his field. Over the least eighteen years David has led technology and training companies through emerging fields and technology trends helping them to understand the future and develop business opportunities. As Head of Emerging Technologies he works closely with customers and industry experts to ensure the opportunities and threats of new technology trends designing custom learning solutions to help small and enterprise organisation adapt and make the most of their people - ensuring QA is ready when our customers need to navigate the minefield of the fast moving digital landscape. His passion is in advanced web engineering principals and vendor neutral thick client design/development technologies reflected in his research, analysis and courseware development experience combined with his training delivery skills. As a technologist he is the lead instructor and syllabus author for web development technologies and specialising in Agile, DevOps, and User Experience driven approaches to developing solutions. He has authored courses such as HTML5, Responsive Web Development, User Experience, NodeJS, Javascript and jQuery.
Talk to our learning experts

Talk to our team of learning experts

Every business has different learning needs. QA has over 30 years of experience in combining the highest quality training with the most comprehensive range of learning services, ensuring the very best fit for your organisation.

Get in touch with our learning experts to talk about how we can help.