Visual Studio Javascript BreakPoint没有被命中,为什么? [英] Visual Studio Javascript BreakPoint not getting hit, why?

查看:78
本文介绍了Visual Studio Javascript BreakPoint没有被命中,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以为javascript的代码块设置断点,如下面的屏幕截图所示。
我们如何使用它们? VS始终忽略。

Possible to set a breakpoint for the code block of javascript like the screenshot below. How can we use them? VS always ignores.

推荐答案

如果在调试时将Internet Explorer设置为浏览器,则从理论上讲,Visual Studio可以在客户端设置的断点处停止副脚本。要使用该功能,您需要确保在IE Internet选项的高级选项卡中选中了禁用脚本调试。

If Internet Explorer is set as the browser when debugging, Visual Studio is, in theory, able to stop at breakpoints set at client side script. To use the feature, you will need to make sure that "Disable script debugging" is checked in your IE Internet Options, Advanced tab.

但是,我发现VS脚本调试有点不稳定;断点并不总是命中的,尤其是在VS2010或更早的版本中。我的个人经验是,它在VS2012或更高版本中效果最佳。

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

也就是说,如果您使用VS作为客户端脚本调试器,并且发现客户端断点没有受到影响,则最好插入一个调试器;您想在该行之前插入一行,以确保它被VS脚本调试器拾取。

That being said, if you're using VS as the client-side script debugger and you find that your client-side breakpoints are not getting hit, it is best to insert a "debugger;" line prior to the line you would like to break at to ensure that it is picked up by the VS script debugger.

pennstatephil上面的链接确实提供了有关该主题的更多信息: http://msdn.microsoft.com/zh-cn/library/7seh8d72.aspx

pennstatephil posted a link above that indeed provides more information on the subject: http://msdn.microsoft.com/en-us/library/7seh8d72.aspx

编辑:我无法添加注释,但是为了回应sb9关于为什么要使用IE的注释,在调查回发发生之前的脚本行为以及回发之后立即发生的服务器端行为时,我发现Visual Studio中的调试更加方便。另外,有时VS / IE组合会捕获Chrome和Firefox / Firebug报告的错误消息,并带有无意义的错误消息。

I'm not able to add comments, but in response to sb9's comment about why one would use IE, I find debugging in Visual Studio a lot more convenient when investigating script behavior before postbacks occur and server-side behaviors occurring immediately after postbacks. Also, sometimes the VS/IE combination will catch errors that Chrome and Firefox/Firebug reports with a nonsensical error message.

这篇关于Visual Studio Javascript BreakPoint没有被命中,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆