views:

4156

answers:

5

I am not able to use the breakpoint in Studio with Javascript. I'm able to debug if I use the debugger;

I've seen this Breakpoint not hooked up when debugging in VS.Net 2005 question already. I tried the answer and it didn't work.

Looking in the Modules window, V.Mvc.Jobtrakt.PDB is loaded properly, but it points to a temp folder C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\dbc0c0c5\f64a99b3\assembly\dl3\9de055b3\eb1303b1_9760c901\V.Mvc.Jobtrak.pdb: Symbols loaded.

I would have thought that it would point to: \JobTrak\Website\V.Mvc.Jobtrak\V.Mvc.Jobtrak\obj\Debug ( this is within the project directory)

But regardless of the location I closed VS 2008 and then blew away the temp folder (listed above), the bin and obj folders.

Opened VS 2008 and did a clean. I set a break point in the js and it seemed like it would work now ( The breakpoint was filled in) Started to debug and it never breaks on the breakpoint. Look at the break point and it now is a red circle with a red dot and a warning indicator. Hovering over the breakpoint gives me this useful information: The breakpoint will not currently be hit. The location could not be mapped to a client side script. See help for ASPX Breakpoint mapping. I am not being redirected, the breakpoint is with in a function. blah blah blah this should be working.

So I was wondering if anyone has any ideas? Is anyone able to set breakpoints in VS2008 and have them work?

+2  A: 

Make sure you are attached to the correct process. For example, once you have your page loaded in IE,

  1. Switch to Visual Studio and go to the Debug menu.
  2. Choose "Attach to Process"
  3. Find iexplore in the list and select it.
  4. Click the "Select..." button.
  5. In the dialog, choose "Debug these code types:" and select only "Script".
  6. Click "OK"
  7. Click "Attach"

See if that helps get you debugging javascript.

palehorse
+6  A: 

try typing "debugger" in the source where you want to break

Greg Dean
Good call Greg. That one is a definite fast track to the debugger.
palehorse
This does work. I was trying to get the breakpoints to work.
Brad8118
This actually worked like a charm for me.
RexM
A: 

Greg answered the question, however just to add some more value to answer -

Put debugger in the java script code.

As well make sure you have debugger enabled in the internet explorer > Tools > Internet Options > Advance

the check boxes for disabled debugging should not be checked.

Mutant
A: 

Yes, that is right. but, then WHY IN VS2010 IS THERE BREAKPOINTS IN THE JAVASCRIPT CODE???!!! It will stop at the 'debugger' statement, NOT at the breakpoints. Or has anyone got this to work? I'm using master pages, so maybe that's too much complication for the debugger to handle!?

chris