Question

Visual Studio randomly crashes when adding/removing references and projects. Any thoughts why? Will installing Sp1 help?

EDIT: I do not work with any addons except SourceSafe. I do most of my development in connected mode.

Developing using:
Visual Studio 2008
WinXp Terminal Service -> Win2k3 Sp2 (64bit)
VSS 8.0, 32bit

Was it helpful?

Solution

Try deleting your .user and .suo files - these are the user options files that VS creates. You get a .user file for each project and a .suo file for your solution. When they get corrupted, odd things happen. Deleting them will make you lose little things like which project is selected as the startup project when you start debugging, but it usually clears up odd behavior like this.

You may also want to clear out any temporary file locations, like the Temporary ASP.NET Files folders (if you're working in ASP.NET) just in case something odd is being cached somewhere.

OTHER TIPS

My Visual Studio 2005 started crashing and locking up recently. The way I finally fixed it was to run this from the command line:

devenv /resetuserdata

That cleared out all my customisations, but it did fix the problem. If you've customised VS a lot, you could try exporting your settings first and then see if you can safely import them afterwards. Alternatively, take snapshots of your IDE so you can remember which buttons etc. you had where.

Most commonly, if Visual Studio is crashing repeatedly, your .suo or .ncb file has become corrupted. Close your project, delete those files, and reopen. This may resolve your problem.

.suo is a hidden file.

Beware if you suspect a corrupt .suo file and are integrated with Source Safe.

When you restart VS after a crash, you may get the following message:

The Open from Source Control operation is still in progress but you can start working now. the rest of the projects will be retrieved asynchronously.

This basically means VS will load all projects in your opened solution from Source Safe and Overwrite any files that are checked out and contain unchecked-in changes!
After a VS crash, start Source Safe standalone and CHECK IN what you want to preserve.
Then work at fixing the corruption before starting VS again.

Hopefully this helps someone. It felt like I had tried everything. I even repaired the installation, which made no difference as well as removed VS entirely and the issue was still there. The log option told me nothing significant, so I eventually deleted all the bin and obj folders in my solution as well as all the .suo and .user files and moved it to a completely different folder off the root folder on my harddrive and rebuilt it. It magically came right!

Search for and delete any .ncb files associated with your solution. In past versions these (debugging) files used to get corrupt and deleting them would fix the problem (Visual Studio will regenerate them automatically).

I Find on mine even in SP1 that it crashes rarely when adding stuff to a project, but mainly when switching to an ASP.NET Design View and when it autogenerates controls in the tools. I just disabled it from creating them and i dont get many crashes any more.

I know this doesnt have much to do with your issue, but the point i am making SP1 may not be the answer to your problem.

I tried all of the suggested options, and a few more found at this link. No luck.

Then I tried to add a reference from a Web Site (as opposed to Web App). The process is different: you have to right click the project and go to Property Pages, and there's an Add... button on the References tab.

It still crashed, but there was a message in the Event Viewer this time that pointed me to the full path of a DLL in a 3rd party component I have installed. The DLL couldn't be read from disk (corrupt). So, a repair of that lib and a reboot later, and I'm back to good.

UPDATE:

I came to find out the real reason, several files on my SSD had become corrupt. CHKDSK /R got me back going for a while. Eventually had to replace the drive. Just a reminder that it may not be VS's fault.

changing the default solution location solved my problem.

I had to remove older reference for the project that no longer existed from the solution and that worked fine for me.

If .suo or .ncb file has become corrupted, that causes for visual studio crashing also. To solve this crashing you can use the following step as mentioned in the image.

  1. Go to the folder that contain visual studio execution file(devenv.exe).
  2. open the command prompt with the folder path mentioned in the step one and run the command devenv.exe /ResetSettings.
  3. If step two doesn't solve your problem then run the command devenv.exe /ResetUserData.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top