Usual morning starts. The new day with new code challenges. You're eager to start fast and deliver something today. You know you will have the first phase of changes until noon. Dev machine is booting, first cup of coffee is on the desk - it tastes so good. Mhmm. Miracle morning ?
It will be complicated change in the code base but you're prepared. The last three days you were hunting the bug - it was hiding but finally you've nailed it to the ground. All puzzle parts are there - carefully collected in your favorite IDE. You cannot be more ready, solution is loading and ...
Visual Studio opens blank
WTF ? Where are my opened windows with the code ?
... you know something terrible happened a moment ago. You got an instant adrenaline injection into the blood stream. Yep, it will be shitty morning. You're desperate to recover your precious treasures at all costs. It'll be long and stressful morning.
You're trying to calm down but you feel how blood flows into your temporal lobes. It's not your first time when this happens and you're prepared. You know possible fixes and how to recover your lost context.
Top 3 fixes
- Launch Visual Studio with "Run as Administrator" once, close it and launch again as normal.
Is not working ? Try another possible fix.
- Reset VS's settings
devenv.exe /resetsettings
It will reset your IDE settings so it's good to make a backup before hitting enter (VS -> Tools -> Import and Export Settings). How to find devenv.exe location fast for specific VS version:
Still doesn't work ?
- Reset VS internal state
Run
devenv.exe /setup
as administrator
I found that it's one of the best trick that fixes all sort of VS's weirdness. It resets VS internal state, does good job and it's safe.
Necessity and sufficiency: All those tricks could help then and only then when .suo file is not internally broken. If it is broken nothing will help, hope is gone ...
... unless you will be using ContextKeeper plugin for VS - available soon for beta testing! Stay tuned.
Bonus Trick
Keep your .suo file in safe place and backup it frequently if it contains important context for your actual or future work. Yes I'm serious.
It's a hack, useful one, but still a hack. Does squaring the circle sounds familiar ?
We hear all the time to NEVER put .suo file to a repository. On the other hand it contains extremely important information - the context that allows us to be productive.