简体   繁体   English

如何在Visual Studio或IE11中调试严重的JavaScript错误(语法/ SCRIPT1002)?

[英]How do I debug critical JavaScript errors (syntax/SCRIPT1002) in Visual Studio or IE11?

I have a web app that crashes in IE11 with an uninformative “SCRIPT1002”. 我有一个Web应用程序,该窗口应用程序在IE11中崩溃,显示的信息不详“ SCRIPT1002”。 It's not a Javascript runtime error; 这不是Javascript运行时错误; so the F12 dev tools are no help: I cannot break on the error (since it's not a Javascript exception), and the only information about the error location points to a blob: URL, not a .js file. 因此F12开发人员工具无济于事:我无法打破这个错误(因为它不是Javascript异常),并且关于错误位置的唯一信息指向一个blob: URL,而不是.js文件。

SCRIPT1002: Syntax error blob:60AFFCE5-6A4E-418D-B628-9DFA4578396A SCRIPT1002:语法错误Blob:60AFFCE5-6A4E-418D-B628-9DFA4578396A

Needless to say, the blob: URL does not actually open to any code. 不用说, blob: URL实际上并未打开任何代码。

Trying to attach Visual Studio to IE, I still can't seem to find out what the actual error is. 尝试将Visual Studio附加到IE时,我似乎仍然找不到实际的错误。 Visual Studio pops up an error dialogue with: Visual Studio弹出错误对话框,其中包含:

JavaScript critical error at line 1, column 663 in blob:60AFFCE5-6A4E-418D-B628-9DFA4578396A\\n\\nSCRIPT1002: Syntax error 第1行第1栏的JavaScript严重错误:60AFFCE5-6A4E-418D-B628-9DFA4578396A \\ n \\ nSCRIPT1002:语法错误

With a blob: URL, I don't see how I can look up the error location; 对于blob: URL,我看不到如何查找错误位置。 with no details beyond Syntax error , I cannot infer it. 除了Syntax error ,没有其他详细信息,我无法推断出来。

Is there any way using IE11 and/or Visual Studio (Community) to find out what the problematic code is, and/or the details of the syntax error? 是否可以使用IE11和/或Visual Studio(社区)找出有问题的代码是什么,和/或语法错误的详细信息?

You can use the Developer Tools Tool IE11: 您可以使用开发人员工具IE11:

  • In IE11, press the F12 key. 在IE11中,按F12键。 That will open the Developer Tools 这将打开开发人员工具
  • Reload your page or do whatever will trigger the error and you will see it in the Console tab 重新加载页面或执行任何会触发该错误的操作,您将在“ 控制台”选项卡中看到它
  • Double-click on the error and it will take you to the error location in the code in the Debug tab. 双击错误,它将带您到调试选项卡中代码中的错误位置。

You have several debug tools in the Debug tab such as Watches , Call Stack , and Breakpoints . 在“ 调试”选项卡中有几种调试工具,例如监视调用堆栈断点 You can also execute your JavaScript code line by line. 您还可以逐行执行JavaScript代码。

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

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