How to fix Visual studio loading errors, using IFix

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.

image

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:

image

or for a specific version, doing “ifix mefcache  -f    – -vs2015”

image

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.

About terje

See http://about.me/terjes

  • Rob Prouse

    Thanks Terje, you got my Visual Studio up and running again!

  • Is this more or less the same as running “Devenv /updateconfiguration”? That is also supposed to fix the MEF cache.