views:

330

answers:

2

Visual Studio Team system 2008 crashes without any error messages whenever I try to open a specific Javscript 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  A: 

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.

Jason Bunting
I don't have PowerCommands installed but that is still good to know, thanks!
Josef
A: 

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.

Jason Bunting