11

I've seen a lot of similar questions, but I don't think I'm duplicating. Here's my situation. I have three solutions that I'm working with. A works fine, but when I try to load B or C, VS 2010 crashes shortly after loading the solution, particularly after I try to open a file form my solution explorer.

What I've tried:

  1. Disabling all add-ins and macros vis tools -> options -> add-in/Macros Security then unchecking the two relevant check boxes

  2. Deleting my .suo file.

  3. Rebooting my machine

  4. Running VS 2010 as Administrator

Here's the error from my event viewer

Faulting application name: devenv.exe, version: 10.0.30319.1, time stamp: 0x4ba1fab3 Faulting module name: cslangsvc.dll, version: 10.0.30319.1, time stamp: 0x4ba20c61 Exception code: 0xc0000005 Fault offset: 0x0024b651 Faulting process id: 0x1408 Faulting application start time: 0x01cbddd78972584a Faulting application path: c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe Faulting module path: c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC#\VCSPackages\cslangsvc.dll Report Id: cd32c352-49ca-11e0-b3d8-0026b9c2aa7e

EDIT

This is a solution with two projects -> a win forms project, and a console project. Both in C#

RESOLUTION

It turns out there was some silly (stupid?) code in my solution that was making VS go crazy. The code should never really have been in there; it was just something I wrote playing around for no good reason.

On a related note, if you ever want to be evil to someone you don't like, insert the following code into their solution somewhere, and sit back and watch the fun:

namespace System {
    public partial class Boolean { }
}

I put this code into the first solution, and watched it crash after building. I ass-umed the crash was unlreated to the code I had just written and proceeded to put it into my second solution to see if it was possible to extend Boolean without extension methods, then got angry that VS was still crashing. That code could be capable of crashing VS never crossed my mind.

5
  • I've seen this issue with bad XAML (yes I know it sounds stange) Does that solution B and C actually compile? (Try using MSBuild to find out). Fix any compilation errors, and try again.
    – vcsjones
    Commented Mar 8, 2011 at 21:45
  • I don't think we're able to help you with that. I suggest filing a bug report with Microsoft.
    – DarkDust
    Commented Mar 8, 2011 at 21:46
  • Is it the same file (or file type) that you open each time when you get the crash, or can it be any random file from either project?
    – Simen S
    Commented Mar 8, 2011 at 22:02
  • It's the same two projects. What could I look for in these projects to see what's killing my IDE? Commented Mar 8, 2011 at 22:07
  • I had exactly the same problem only moments ago and the resolution was similar, but for me it was a different line of "silly" code. I'd like to provide the example here in case anyone else is troubled by this. Specifically for me it was var x = __arglist(1, 2); One might say I deserved it for messing around with undocumented features, but I think crashing the IDE is a bit extreme. One thing's for sure, I am definitely less excited about messing around with undocumented features now. :P Commented Dec 19, 2013 at 20:06

7 Answers 7

14

Try disabling all extensions via tools -> extension manager. I've had extensions crash visual studio only in certain projects.

Alternatively try running VS in safemode: devenv.exe /SafeMode

2
  • 1
    Wow, neither worked. My goodness. Thank you for the answer though +1 Commented Mar 8, 2011 at 21:51
  • have you tried loading the solution on another machine? maybe your install is somehow corrupted
    – Michael
    Commented Mar 8, 2011 at 21:56
5

I tried the following in the order i performed:

  1. devenv.exe /resetsettings , devenv.exe /resetskippkgs (did not work)

  2. devenv.exe /safemode (told me that product version cannot open .ccproj types. But no counter solution worked)

  3. renamed the .user, .suo files (did not work)

  4. Installed any and every service pack for VS2010 even if they were remotely related to C# development.

  5. "Reinstalled" VS2010 using the 'repair/reinstall' option(did not work)

  6. Uninstalled VS2010 and then installed (this was my solution even though many of them tried this and failed. Might be because this was my last resort.)

4
  • 1
    Create another solution and add existent projects in your new solution. VS often crash because of the designers. You can debug visual studio by editing an existent plug-in. Also try to inspect csproj file of each project in your solution; Commented May 12, 2012 at 14:14
  • This was the first thing I did and it failed me. Commented May 24, 2012 at 0:05
  • I created a tool to backup-recover my current project and csproj files. Since then I never had black experiences again. So, the best method is to back up your files. Commented Jun 7, 2012 at 20:37
  • Nice one @yoosafinpace - I just repaired a crashing Visual Studio 9 by using devenv.exe /resetsettings. I was unable to open any solutions. This happened after I uninstalled Visual Assist X trial version. Had tried doing a 'repair' without success, then found your answer here. Thanks for documenting your process. Step 1 worked for me.
    – paddy
    Commented Feb 27, 2013 at 20:59
2

If it's a C++ project, try deleting any PDB files that are hanging around - these sometimes get corrupted and cause crashes.

1
  • It's a plain old, boring solution with both a C# win forms app, and a console app, nothing more :( Commented Mar 8, 2011 at 21:53
2

I encountered a similar problem, VS2010 crashed upon loading a specific solution. It turned out to be an incomplete line in the code that caused VS2010 to run amok. When I commented the line out, everything was ok.

The line in question was:

getCommonResourcesDirectory([out, retval] BSTR* );
1

A crash can also happen in Visual Studio 2010 during solution load if/when the testing tools (Test View window etc.) load a DLL that throws an exception during initialization.

My specific case was a C++/CLI test project where a global variable was throwing an exception during construction of it, that constructor being called during DLL INIT. (It was the std::tr1::regex class constructor throwing due to invalid pattern string passed to it.)

This was quite a subtle problem because you don't expect your code to run until you execute the test; but in the case of ctors of C++ globals it is being run by the IDE immediately after build and on solution load.

I suspect Visual Studio 2010 test manager component isn't wrapping the Dll load call in a try/catch block where it might.

0

Set the form that crashes Visual Studio as the main form to load. Then start the form in debug mod from the DEBUG menu.

0

I realize this is an old post, but I came up with another solution today as I was working on the same issue. In my case, VS was trying to open a source code file using the CSharp Form Editor instead of the CSharp Editor.

When that happened, the code started to run (I saw my splash screen) but an error occurred (I saw my error message about not finding some hardware) and the resulting error closed VS. Trying to reopen the project would have VS open the *.cs file again, creating a frustrating loop of crashes.

I was able to open the project after deleting the *.suo file. Then in Solution Explorer I right clicked the code file and selected Open With. In the dialog I changed the default and everything was fine, including seeing the hardware that I was not finding before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.