Visual Studio 2008 crashes when I open a JavaScript file?

萝らか妹 提交于 2020-01-14 09:35:35

问题


Visual Studio Team system 2008 crashes without any error messages whenever I try to open a specific JavaScript file. I found this thread on social.msdn but installing the KB958502 hotfix didn't fix the problem.

Has anyone else experienced this and solved it?


回答1:


Do you have PowerCommands for Visual Studio 2008 installed? If so, check this post for help:

FIX: PowerCommands for Visual Studio 2008 Crashes IDE

The exact same thing happened to me when I was opening some JavaScript files.




回答2:


Since this is a different "answer" than my last, I am creating another post/entry.

I did experience this from time to time on a project I was on last year. I was using MochiKit as my toolkit, so take that into consideration.

Basically, I had some code like this in a file called common.js, which ran in the global scope:

if(typeof(DomEvent) == "undefined") {
   DomEvent = {};
   var domEventNames = [
      "onabort", "onblur", "onchange", "onclick", "ondblclick", "onerror", "onfocus", 
      "onkeydown", "onkeypress", "onkeyup", "onload", "onmousedown", "onmousemove", 
      "onmouseout", "onmouseover", "onmouseup", "onreset", "onresize", "onscroll", 
      "onselect", "onsubmit", "onunload"
   ];
   // forEach is a MochiKit function; functionality should be obvious
   forEach(domEventNames, function(eventName) {
      DomEvent[eventName] = eventName;
   });
}

So, it basically dynamically builds an object assigned to the variable DomEvent and creates properties on that object that are have the same name as the value it holds (string representations of common browser events).

Now, I wanted Intellisense to help me with the API in other files, so in other files, I would have the following line in the top of the file:

/// <reference path="common.js"/>

That tells Visual Studio to "import" the API from that JavaScript file for use with Intellisense in the file this declaration is used in.

So I speculated that since the code in the common.js file, which I showed above, was building a global variable's value dynamically, Visual Studio was barfing on it. I felt fairly good about this hypothesis because the JavaScript code itself is sound, and Visual Studio would only crash if I used that XML comment to assist Intellisense. If I removed it, there wasn't a problem.

Hope that helps you or someone else.



来源:https://stackoverflow.com/questions/921894/visual-studio-2008-crashes-when-i-open-a-javascript-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!