3

I know Javascript breakpoints are possible because I used to do it all the time in my previous job using VS2010. At my new job now, VS tells me it can't set the breakpoint. Instead, I have to put debugger; in my code and then choose another instance of VS for debugging, but I don't want to do it that way. It's much easier to set a breakpoint, attach the debugger to the dev server, and run my code.

Edit: I just thought about it and will add that I was also using Telerik's RadCodeBlock in the past. Let me look into that more and see if that's why I was able to set script breakpoints.

oscilatingcretin
  • 10,457
  • 39
  • 119
  • 206
  • More of a sanity check than an answer.. Have you made sure that the build is set to Debug and not Release? – Seany84 Nov 29 '11 at 11:33
  • Yep, it's debug, although I am not sure how that would affect it. – oscilatingcretin Nov 29 '11 at 11:35
  • Just came across this: http://forums.asp.net/t/1587093.aspx/2/10?Can+t+insert+breakpoints+in+JavaScript+in+VS+2010 I wonder is there a hotfix/solution. The post is dated Aug 2010. – Seany84 Nov 29 '11 at 11:40

1 Answers1

2

This only works when you view your website using the build-in webdevserver and view the website in IE. In the solution explorer of VS2010 you will see the dynamically created pages being listed somewhere in the tree. The same holds for the javascript. You can place breakpoints inside these files, which will be picked up by by the debugger. In this way you can debug the javascript just as easily as your other code.

Pieter
  • 3,339
  • 5
  • 30
  • 63