在页面检查器中启用 javascript 调试器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12197255/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 07:22:50  来源:igfitidea点击:

Enable the javascript debugger in the Page Inspector

javascriptvisual-studio-2012visual-studio-debugging

提问by Martijn

Visual Studio 2012 comes with the very nice Page Inspector. I like it! Problem though, I haven't found how (if?) I can turn on JavaScript debugging. Could someone point me in the right direction?

Visual Studio 2012 带有非常好的页面检查器。我喜欢!但问题是,我还没有找到如何(如果?)我可以打开 JavaScript 调试。有人能指出我正确的方向吗?

采纳答案by Mariusz

  1. In IE9 (only one time): Tools > Internet Options > Advanced tab > In Browsing category > Clear "Disable script debugging" check boxes (both) > restart IE.

  2. In VS 2012: Run the Page Inspector ( when javascript error box opens, click No ! )

  3. Choose from VS menu: DEBUG > Attach to process...

  4. Select "WebBrowserServer.exe" and click Attach

  5. In Page Inspector window click the Refresh icon.

  1. 在 IE9 中(仅一次):工具 > Internet 选项 > 高级选项卡 > 在浏览类别中 > 清除“禁用脚本调试”复选框(两者)> 重新启动 IE。

  2. 在 VS 2012 中:运行页面检查器(当 javascript 错误框打开时,单击否!)

  3. 从 VS 菜单中选择:调试 > 附加到进程...

  4. 选择“WebBrowserServer.exe”并单击“附加”

  5. 在页面检查器窗口中单击刷新图标。

Debugging works pretty well, but it's one condition. Don't insert any breakpoints in your code (or clear them before - DEBUG > Delete All Breakpoints). There can cause a lot of problems - from hanging and frozing to entirely crashing your VS.

调试工作得很好,但这是一种条件。不要在您的代码中插入任何断点(或在之前清除它们 - DEBUG > Delete All Breakpoints)。这可能会导致很多问题 - 从挂起和冻结到完全崩溃您的 VS。

回答by user1161391

Until this week, I was able to carry debugging of JavaScript in Visual Studio 2012 merely by entering "debugger" in the JavaScript function which acted as a breakpoint, and was able to step through the JavaScript code in the Visual Studio window just the same as the C# code. I did this for the past 11 months until 1 week ago. I made no changes to the default installed settings.

直到本周,我才能够在 Visual Studio 2012 中进行 JavaScript 的调试,只需在作为断点的 JavaScript 函数中输入“调试器”,就可以在 Visual Studio 窗口中单步执行 JavaScript 代码,就像C# 代码。在过去的 11 个月里,我一直这样做,直到 1 周前。我没有更改默认安装的设置。

This was the solution suggested in the Asp.Net Forums by Rion Williams. http://forums.asp.net/t/1984115.aspx?Debugging+Javascript+in+MVCAnd as stated it has allowed me to properly step through my code for the last 11 months.

这是 Rion Williams 在 Asp.Net 论坛中建议的解决方案。http://forums.asp.net/t/1984115.aspx?Debugging+Javascript+in+MVC 如前所述,它使我能够在过去的 11 个月中正确地逐步执行我的代码。