Visual Studio is normally a very stable environment, but some times it might crash on you. This might happen if you either install some new extension, or even if you update Visual Studio. The latter can be rather annoying of course.
A “common” error message is the loading error, it says it can’t load some component correctly, like in the image below.
What component it is might vary, it doesn’t seem to be any pattern to it. And some times it even give you multiple of these.
A very common cause for these crashes is a corrupted MEF cache.
All versions of Visual Studio (post 2012) uses MEF to load it’s own components. These components are also being cached in a mef cache.
When you do install things, or do some updates to Visual Studio it happens that this cache gets corrupted, and then Visual Studio might do this complaining about not loading correctly.
The way to fix this is to delete the appropriate cache.
You can either use the command line tool IFix , using the command “ifix mefcache –f – – all” , which deletes all caches for all versions:
or for a specific version, doing “ifix mefcache -f – -vs2015”
It doesn’t matter from where you run the IFix tool, it can be from anywhere.
Or do it manually, doing a rmdir – using the information below:
The different versions have their cache at:
Version | Location |
VS 2012 | %localappdata%\Microsoft\VisualStudio\11.0ComponentModelCache |
VS 2013 | %localappdata%\Microsoft\VisualStudio\12.0\ComponentModelCache |
VS2015 | %localappdata%\Microsoft\VisualStudio\14.0\ComponentModelCache |
After the cache has been deleted, you must restart Visual Studio.
Also, if you have any other type of error in Visual Studio that just suddenly happens, it can be wise to delete the mef cache. It will rebuild itself when you restart, so it has no bad side effects.