Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug Javascript IE 9

Tags:

javascript

I am using Visual Studio 2010 and IE 9. I am trying to debug javascript .js files in my Solution. I put the break point in the files and can't do it no matter what. I have tried doing things like unchecking options in IE like disable script debugging. And I can't do it no matter what.

Am I missing anything ?? I was able to debug javascript files yesterday and I am not able to do it today.

I pressed F12 AND Hit start debugger in developer tools of IE 9 and it gave me the message:

'Unable to attach to process. Another debugger might be attached to the process'

Any ideas and suggestions on what could be wrong.

like image 480
SaiBand Avatar asked Sep 15 '11 21:09

SaiBand


People also ask

How do I debug JavaScript in IE?

Right click to 'Inspect Element', or click on F12 Developer Tools from the gear icon to open the Developer Tools pane. Click on the "Debugger" tab. Click on the Stop sign icon.

Is there a way to debug JavaScript?

But fortunately, all modern browsers have a built-in JavaScript debugger. Built-in debuggers can be turned on and off, forcing errors to be reported to the user. With a debugger, you can also set breakpoints (places where code execution can be stopped), and examine variables while the code is executing.

How do I debug JavaScript script?

Javascript provides the keyword Debugger to debug the code. When we add the debugger keyword in between our code, so after executing the code, a debugger panel will show up where we can make breakpoints and play/pause to check the value and understand according to it.


1 Answers

When you hit F5 and Debug in Visual Studio it sometimes either doesn't attach the debugger to IE9 correctly, or normally in my case it just refreshes the app pool on a local running instance of Cassini (your Visual Studio Dev WebServer), which often if its already running will not let the VS Debugger attach correctly.

If you click in your system tray, find the icon for Cassini (ASP.NET Developement Server) - just right click and hit stop. Then go back to Visual Studio and F5 again, and the debugger should attach again ok.

My favorite thing to do is actually CTRL+F5 and run the web app without debugging so I can use the built in (F12) debugger in IE9. By doing that, you will not get the "Unable to attach to process..." message, and you will also be able to tell whether your Javascript edits are actually being refreshed or cached in your browser while you are developing.

like image 147
ericb Avatar answered Sep 20 '22 10:09

ericb