Visual Studio Javascript BreakPoint Misses, Why?

You can set a breakpoint for the javascript code block, as shown below. How can we use them? VS always ignores.

enter image description here

+8
javascript visual-studio breakpoints
source share
4 answers

If Internet Explorer is configured as a browser during debugging, Visual Studio could theoretically stop at the checkpoints set on the client side of the script. To use this function, you need to make sure that "Disable script debugging" is checked on the tab "IE Internet Options", "Advanced".

However, I found that VS script debugging would be a bit flaky; breakpoint does not always hit, especially with VS2010 or earlier. My personal experience is that it works best in VS2012 or later.

If you use VS as a client debugger script, and you find that your control points on the client side do not fall, it is better to insert a "debugger"; lines to the line you would like to split to make sure that it is matched by the VS script debugger.

pennstatephil posted the link above, which does contain additional information on this subject: http://msdn.microsoft.com/en-us/library/7seh8d72.aspx

Edit: I cannot add comments, but in response to sb9's comment about why IE should be used, I find that debugging in Visual Studio is much more convenient when examining the script behavior before the postback occurs and on the server side the behavior occurs immediately after the postback . In addition, sometimes the VS / IE combination will catch errors that report Chrome and Firefox / Firebug reports with a meaningless error message.

+9
source share

Another scenario where the debugger is unable to stop at a breakpoint is to use a package. To debug JavaScript files, we need to remove the binding.

Hope this helps someone.

+2
source share

There are apparently endless possibilities why this is happening. I just solved this problem after several hours of searching, so maybe my solution might help someone.

My particular problem is that my breakpoints were disabled immediately after my employee included the package ( see description here ). I had to go into our BundleConfig.cs file and comment on the line that said:

BundleTable.EnableOptimizations = true; 

After I did this, they were amazed. You want to add this line for deployment.

+1
source share

Yes, you can put a breakpoint on the client page in Visual studio

First put the debugger in the java-script code and run the page in the browser

debugger

Add debugger to java-script code

After that, open the page in a browser and view the validation element to see the following view

Side view of breakpoint in java script

0
source share

All Articles