Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
West Wind WebSurge - Rest Client and Http Load Testing for Windows

Visual Studio Script Debugger and Microsoft Script Debugger Mixup


:P
On this page:

Over the last couple of days I’ve been working on client side stuff and have been experimenting with a few different tools for editing and debugging JavaScript. Somewhere in there I installed the Microsoft Script Debugger ontop of the Visual Studio installation (for another tool that needed the script debugger specifically).

 

Both can co-exist but when you install the Microsoft Script Debugger it takes over script debugging for the machine and dumps Visual Studio out of the loop. So I uninstalled and now I am getting the standard IE error:

 

 

This dialog is a pain to read and well, you can’t debug from it.

 

So how do I get Visual Studio Script debugging back? The key’s in the Tools | Options dialog where you can choose VS.NET as the default script debugger for your system.

 

 

 

You turn a setting in one place and it updates another setting in a completely different place. Intuitive, n’est pas? <g>.

 

Hopefully this save somebody else a few minutes... 

 

While at it, there are few other settings required to make this work. You also need to set the IE advanced options to specify that you want to allow script debugging. These options are turned off by default and can be set in the IE Advanced options tab:

Internet Explorer Options to Support Debugging

 

With these settings in place IE script errors should now once again pop up the Big Red warning dialog. Selecting Yes will the pop up a list of debugger options. If you are debugging JavaScript I'd highly recommend NOT to use an existing Visual Studio instance that you care about, since the script debugger has a tendency to lock up. So I usually do my script debugging in seperate instance of VS.

 

The following is nothing, but everytime I mention it to developers when I give a session, there are usually a handful of people in the room who didn't know this: In addition to the dialog pop ups on errors that allow you to debug script code, you can also force the debugger to activate with the debugger; keyword. For example:

 

var Callback = new wwCallbackMethod("LookupPanel","SimpleMethodCallbacks.aspx");

 

debugger;

     

Callback.postbackMode = "POST";

Callback.CallMethod("AddNumbers",[203.12,213.11],TestCallback,OnError);

 

This will also pop up the script debugger - Visual Studio in IE. If you're using FireFox you can use FireBug or Venkman, both of which let you debug JavaScript code in that browser.

 

Hope this helps...


The Voices of Reason


 

William
September 15, 2006

# re: Visual Studio Script Debugger and Microsoft Script Debugger Mixup

I work a lot with javascript at the moment and the best debugger for javascript I've found as yet is the stock standard visual studio. While it might not help when writing the javascript, debugging it is brilliant with the command view, quick view, watches, step throughs/into/overs... It's really nice.

And the debugger; keyword was one of the better finds this year. You're right that almost nobody knows about it, in fact, one of the people i work with used to physically call methods that he knew didnt exist simply so he could get a fake "breakpoint". The problem then was that you cant step past the point to see what is still going to happen like you can with debugger. Needless to say, I was thanked :)

Another possibly less well-known (nobody at my office knew this, not sure if that says something bad about my office or not :P ) debugging tip (for sql scripts though) is that you can step through stored procedures using Query Analyzer. Right click on the procedure you want to debug in the object browser and select debug.

Rick Strahl
September 15, 2006

# re: Visual Studio Script Debugger and Microsoft Script Debugger Mixup

Yeah for debugging I agree. Compared to the FireFox alternatives the VS debugger is awesome. But alas, it also has its problems like the feature that it doesn't skip over code (short of manually moviing it) once an error has occurred and frequent lockups that require restarting. Also the process of getting to the debugger is cumbersome with the dialog box popping up each time even when the debugger is already attached to IE which is just plain silly.

I'm sure we'll eventually get a decent environment for this in Orcas. You might want to check the previous post regarding JavaScript editors. Some of the environments there integrate debugging into the environment (or claim to anyway <g>).


William
September 18, 2006

# re: Visual Studio Script Debugger and Microsoft Script Debugger Mixup

I managed to get my VS set up so that it doesn't pop-up with that select debugger screen... cant remember exactly how though.

Also, I suspect your VS crashing is possibly a Vista problem? I've been using VS to debug JS for quite a long time and haven't had it crash on me once yet (XP Professional) unless I try and do a quick view or add a watch on a method that opens a Modal Dialog.

I have great expectations for Orcas, lets hope it doesnt dissappoint... I'd also like some better debugging support for windows services, it seems a great effort to re-install the service everytime some small bug works its way into the service somehow. I'm sure there's an easier way, I just don't know how yet

Subs
February 15, 2007

# re: Visual Studio Script Debugger and Microsoft Script Debugger Mixup

Thanks a million! I've spent all morning trying to get Vis Stud script debugging back after install Microsoft Script Editor. This article's saved my bacon!

Henrik
December 20, 2007

# re: Visual Studio Script Debugger and Microsoft Script Debugger Mixup

The Visual Studio debugger is fairly decent, but it only has one advantage over Firebug; It stops the whole browser while you step through the code. So for singlestepping rendering behaviour its pretty good. Shortcomings that I know of are:

* You have to create a bogus site it set breakpoints before launching a page(re-launching that is). No I don't want to have to modify the source to debug with the debugger keyword.

* You can't break on the first line of a function.

* It's for code, and oblivious to CSS and HTML.

* Browsing nested data structures isn't very good.

Actually it also has one other nice feature. Set next statement, which lets you repeat or skip code lines.

Firebug only pauses the current event handling when reaching a breakpoint, which means that you get out of order execution. Personally I haven't found it a big issue once I understood what it was doing.

Rana
April 22, 2008

# re: Visual Studio Script Debugger and Microsoft Script Debugger Mixup

It resolved one heck of a problem which I am used to living with for quite sometime now.
Thanks Rick. A really helpful post. I unistalled Microsoft script debugger and since then there was no way I could have debugged the script. I re-installed the debugger and followed the steps you mentioned (tools/options) and it worked..

era
June 18, 2010

# re: Visual Studio Script Debugger and Microsoft Script Debugger Mixup

I am getting error as follows when i am going to debug the application using visual studio..How can fix this? Tried various things but still couldn't find a solution

Error.
'Attaching the script debugger to [2844]iexplore on machine 'MechineName' faild. A degugger is already attached. '

era
June 18, 2010

# re: Visual Studio Script Debugger and Microsoft Script Debugger Mixup

I am getting an error as follows , when i am going to debug the application using visual studio..How can fix this? Tried various things but still couldn't find a solution

Error.
'Attaching the script debugger to [2844]iexplore on machine 'MechineName' faild. A degugger is already attached. '

era
June 18, 2010

# re: Visual Studio Script Debugger and Microsoft Script Debugger Mixup

I am getting an error as follows , when i am going to debug the application using visual studio..How can fix this? Tried various things but still couldn't find a solution

Error.
'Attaching the script debugger to [2844]iexplore on machine 'MechineName' faild. A degugger is already attached. '

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024