简体   繁体   中英

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”. It's not a Javascript runtime error; 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.

SCRIPT1002: Syntax error blob:60AFFCE5-6A4E-418D-B628-9DFA4578396A

Needless to say, the blob: URL does not actually open to any code.

Trying to attach Visual Studio to IE, I still can't seem to find out what the actual error is. Visual Studio pops up an error dialogue with:

JavaScript critical error at line 1, column 663 in blob:60AFFCE5-6A4E-418D-B628-9DFA4578396A\\n\\nSCRIPT1002: Syntax error

With a blob: URL, I don't see how I can look up the error location; with no details beyond Syntax error , I cannot infer it.

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?

You can use the Developer Tools Tool IE11:

  • In IE11, press the F12 key. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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