简体   繁体   English

Visual Studio 2008中的Javascript调试

[英]Javascript Debugging in Visual Studio 2008

I'm trying to debug javascript code just by adding a breakpoint in VS2008, but the debugger's not stopping. 我试图通过在VS2008中添加断点来调试javascript代码,但是调试器没有停止。 Do I have to do some special setup in order to enable javascript debugging? 我是否必须进行一些特殊设置才能启用javascript调试? Or does the code have to be in a separate js file? 或者代码必须在一个单独的js文件中?

Did you uncheck the checkboxes in the settings 您是否取消选中设置中的复选框

Tools-->Internet Options-->Advanced-->Browsing [heading]-->Uncheck "Disable Script Debugging (Internet Explorer)" and Uncheck "Disable Script Debugging (Other)" 工具 - > Internet选项 - >高级 - >浏览[标题] - >取消选中“禁用脚本调试(Internet Explorer)”并取消选中“禁用脚本调试(其他)”

Sometimes you need to restart the browser to get VS2008 to recognize that it has made some changes. 有时您需要重新启动浏览器才能让VS2008识别出它已经做了一些更改。

Have you tried to stick the "debugger;" 你有没有试过坚持“调试器”; keyword into your JavaScript file? 关键字到您的JavaScript文件中? This usually never fails me. 这通常不会让我失望。

If you have IE8, you can debug right in the browser itself. 如果你有IE8,你可以在浏览器本身进行调试。

Any particular browser? 任何特定浏览器? Mainly it works with IE, and needs script debugging enabled in the IE internet options (advanced => browsing). 主要是它适用于IE,并且需要在IE互联网选项(高级=>浏览)中启用脚本调试。

I don't know about VS2008, but I know I've never been able to get the debugger to stop on a breakpoint in an aspx (as opposed to a linked js file). 我不知道VS2008,但我知道我从来没有能够让调试器停在aspx的断点上(而不是链接的js文件)。

If you are not running this in a project, but just debugging on the fly, be sure to attach to the browsers' process. 如果您没有在项目中运行它,而只是动态调试,请务必附加到浏览器的进程。

我知道这不是你问的问题,但我必须插入Firebug进行JS调试,包括断点,监视语句,步进和实时JS控制台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM