Zuhaib
Zuhaib

Reputation: 1420

Script Debugging Not Working (VS 2008)

I recently installed VS 6.0 after installing VS 2008 and overwrite JIT settings .. when i started VS 2008 option dialog .. it said another debugger has taken over VS 2008 debugger and I asked me to reset .. so I did ..

Now everything works fine except javascript debugging. I am unable to debug javascript .. I can set breakpoint .. but in debug mode when I hover the breakpoint it says "The breakpoint will not currently be hit. The document is not loaded" ..

How can I solve this issue? Can I reset JIT Settings?

Upvotes: 6

Views: 10458

Answers (6)

Simon_Weaver
Simon_Weaver

Reputation: 145880

If you are using something like ASP.NET Bundles with either

BundleTable.EnableOptimizations = true;

or debug mode set to false the debugger; command will be stripped from your code. Good thing to know :-)

Upvotes: 0

Mathulan
Mathulan

Reputation: 600

Make sure in internet explorer -> Tools -> Internet Options -> Advanced tab the "Disable script debugging" checkbox is unchecked.

This is the classic Disable script debugging checkbox checked after MS so called Security Patch update / revert back to original setting solution.

Upvotes: 0

Laramie
Laramie

Reputation:

I just wanted to chime in and add that the only resolution for me was a reinstall. Luckily just re-applying VS 2008 SP1 did it. I disabled JIT Debugging in VS6, and picked through all the recommended settings in VS2008. My advice is save yourself the trouble and go get some fresh air while the SP installs. You'll be good as new on the next reboot.

Upvotes: 1

BeaverProj
BeaverProj

Reputation: 2215

Have you tried using FireBug for JS debugging? It works pretty well as an alternative to VS.

Upvotes: 1

Zuhaib
Zuhaib

Reputation: 1420

I guess I have to reinstall Visual Studio 2008 and see if that solves this problem

Upvotes: 2

Rihan Meij
Rihan Meij

Reputation: 1759

It sounds like your script debugging is disabled. To enable it goto, tools internet options, advanced and make sure disable script debugging is unticked.

What I also found helps is if you put a

"debugger;"

line in your javascript. Remeber that if you put a debugger statement on the first line in a function it will not attach the debugger, as far as I am aware that is a known bug with the implemention of the javascript debugger engine.

var myFunction = new function()
{
  debugger;
  alert('This will not properly attach the debugger');
}

A workaround to that is:

var myFunctionThatDoesAttachTheDebugger = new function()
{
    var x = 0;
    debugger;
    alert('this should work and attach the debugger');
}

A very usefull way I have also found, is by opening the website you want to debug, and then simply type the following in the url bar:

javascript:debugger;

That will also launch the debugger and give you a opportunity to attach the debugger.

Hope it helps

Rihan Meij

Upvotes: 3

Related Questions