project can't be opened, visual studio crashing
c#, visual-studio
Solution
It sounds like your solution settings were corrupted when Studio crashed. You can reset them by deleting your solution's `*.suo` file:
- Make sure you can view hidden files
- Find your solution in Windows Explorer. It should be a `*.sln` file
- 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.
Problem
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?