Kristian
Kristian

Reputation: 1378

project can't be opened, visual studio crashing

Last thing I did was add a timer in a user control which updates form color. Now every time I open the project, it loads it up and then says 'Visual Studio Stopped Working'.

I noticed that Visual Studio 'runs' the timer while in designer mode too, so I thought that might be causing the problem so I removed the timer from designer.cs and then renamed all the files Visual Studio was opening, but still it crashes. All the other projects work fine. This is the 4th time that it has happened to me. I'm using Visual Studio 2012 Ultimate. Any suggestions please?

Upvotes: 38

Views: 49508

Answers (11)

Oly Dungey
Oly Dungey

Reputation: 1677

I tried most of the other solutions (deleting suo files and all that) but in the end the simple fix for me was:

  1. Open up any known good solution file in Visual Studio.
  2. File/Recent Projects and Solutions - switch to the problematic solution.
  3. Sorted.

No idea what the problem was or why this should fix it.

Upvotes: 0

edin
edin

Reputation: 21

Since I can't respond to the other comment about extensions, here is the extension that was causing this issue for me on Visual Studio 2019 :

MySQL for Visual Studio

I recently installed MySQL on my PC and I guess it automatically installs a version for Visual Studio too, I don't know.

Open one of your projects -> in the top bar click on Extensions -> Go to Installed -> Disable MySQL for Visual Studio (or as the other comment suggests, any other extension that might be causing the issue) -> Restart Visual studio

Upvotes: 0

Jesse Sierks
Jesse Sierks

Reputation: 2397

I installed the Newtonsoft.Json Fixer extension, which worked for me. I had attached another VS to see that the missing file for me was with Newtonsoft.Json, which wasn't referenced by my project, and when I found this extension I thought I'd give it a go.

Newtonsoft.Json Fixer extension

Upvotes: 0

valverij
valverij

Reputation: 4941

It sounds like your solution settings were corrupted when Studio crashed. You can reset them by deleting your solution's *.suo file:

  1. Make sure you can view hidden files
  2. Find your solution in Windows Explorer. It should be a *.sln file
  3. There should be a hidden *.suo file in the same folder. Delete it.

That will reset all of your solution-specific settings, including the windows you had open.

In the future, you can prevent code from executing in the designer by wrapping it in an if using the Form.DesignMode property (inherited from System.ComponentModel.Component):

if(!this.DesignMode)
{
    /* put code to be excluded from the designer here */
}

UPDATE for VS 2017 and 2019

In VS 2017 and 2019, the *.suo file has been moved into a .vs folder within the solution directory:

~/[Solution Directory]/.vs/[Solution Name]/.suo

You can just delete the entire .vs folder to reset your local settings for that solution.

Upvotes: 96

Let me introduce my case when visual studio was crashing when opening a solution but not any solution, only a solution with DevExpress components, other solutions where opening ok until i tried to add a DevExpress component on the form.

The EventViewer indicated the problem has to do with a DevExpress dll. I repaired the DevExpress installation and the problem is fixed. Something broke my DevExpress installation. This only happened once in 20 years i am using their components and i have no idea what caused the problem in the first place.

Having sent that in most cases that i cannot open a single solution i am deleting the .vs folder or the .suo file and the problem is usually fixed. Clearing resharper cache may also help sometimes.

Upvotes: 0

Atif Ali Bhatti
Atif Ali Bhatti

Reputation: 31

Clearing my TFS cache worked for me.

To do so:

  1. Close all instances of Visual Studio on the client machine
  2. Manually delete the corresponding TFS client cache folder, and then start Visual Studio

The corresponding TFS folders to manually delete are as follows:

TFS 2017: %localappdata%\Microsoft\Team Foundation\7.0\Cache\

TFS 2015: %localappdata%\Microsoft\Team Foundation\6.0\Cache\

TFS 2013: %localappdata%\Microsoft\Team Foundation\5.0\Cache\

TFS 2012: %localappdata%\Microsoft\Team Foundation\4.0\Cache\

Upvotes: 2

Thomas Hagström
Thomas Hagström

Reputation: 4528

I don't think there's a suo file any more in VS 2017.

There is however a hidden .vs folder. Try deleting it, worked for me :)

Upvotes: 2

Juraj Petrik
Juraj Petrik

Reputation: 905

If you have a different version of Visual Studio on your computer open that one. Click Debug -> Attach To Process. Select the other Visual Studio process. You should only be able to see one. The Process name is devenv.exe.

Now replicate the problem in the broken VS. It will break on the exception in the unbroken VS.

In my case the exception looked like this

An unhandled exception of type 'System.TypeLoadException' occurred in Microsoft.VisualStudio.Platform.VSEditor.dll

Additional information: Method 'Connect' in type 'JetBrains.UI.SrcView.ContextNotifications.ContextNotificationControl' from assembly 'JetBrains.Platform.UI, Version=104.0.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325' does not have an implementation.

I fixed it by running the Resharper installer and setting the repair option.

Upvotes: 12

spoulson
spoulson

Reputation: 21591

Make sure file permissions are consistent. If the bin or obj folders can't be accessed, Visual Studio may crash. Set file ownership and permissions in file properties -> security -> advanced.

Upvotes: 3

Ankur Goyal
Ankur Goyal

Reputation: 41

Close all the instance of VS 2012. Open VS 2012 in Admin mode (only VS 2012 no solution), then using this instance of VS try to OPEN the project *.sln.

It should open up properly. For me only this solution works nor deleteing *.suo file neither DISABLING the Extentions and Updates.

Hope this helps. Enjoy. What is Stopping You :)

Upvotes: 4

Branden Barber
Branden Barber

Reputation: 1826

Disabling Visual Studio extensions fixed it for me

Tools -> Extensions and Updates -> Installed

In my case, Web Essentials was causing the problem

Hope this helps!

Upvotes: 36

Related Questions