Troubleshooting MEF Cache Issues

Overview

MEF (Managed Extension Framework) is the framework used by Visual Studio to load various extensions. VisualGDB relies on this framework to provide various features related to the text editor, e.g. the smart tags:If VisualGDB detects that Visual Studio has not loaded its MEF extension, it shows a warning pointing to this page.

Checking Assembly References

If the MEF-specific part of VisualGDB is not loading properly, follow the steps below to troubleshoot it:

  1. Locate the VisualGDB extension definition in C:\Program Files\Microsoft Visual Studio\<…>\Common7\IDE\Extensions\Sysprogs\VisualGDB\extension.vsixmanifest. The definition typically contains the following lines:
      <Assets>
        <Asset Type="Microsoft.VisualStudio.VsPackage" Path="VisualGDBPackage.pkgdef" />
        <Asset Type="Microsoft.VisualStudio.MefComponent" Path="C:\Program Files (x86)\Sysprogs\VisualGDB\VisualGDBPackage2022.dll" />
        <Asset Type="Microsoft.VisualStudio.MefComponent" Path="C:\Program Files (x86)\Sysprogs\VisualGDB\VisualGDBTestExtension2022.dll" />
        <Asset Type="UnitTestExtension" Path="C:\Program Files (x86)\Sysprogs\VisualGDB\VisualGDBTestExtension2022.dll" />
        <Asset Type="Microsoft.VisualStudio.MefComponent" Path="C:\Program Files (x86)\Sysprogs\VisualGDB\SysprogsBuildUpToDateCheck2022.dll" />
      </Assets>

    Recheck that the MEFComponent assets contain valid paths and point to the correct VisualGDB assemblies.

  2. Try launching Visual Studio with the /log argument:
    devenv.exe /log

    Then check the %APPDATA%\Microsoft\VisualStudio\<instance>\ActivityLog.xml file for any messages mentioning VisualGDB or MEF errors:
    If you see multiple errors mentioning unresolved assemblies, your Visual Studio installation might be corrupt.

  3. If the log file does not show anything relevant, try opening View->Other Windows->VisualGDB Diagnostics Console BEFORE opening any projects/source files, and then open a VisualGDB-managed source file. You should normally see the following lines:
    SysprogsSuggestedActionsProvider: creating tagger for C/C++ (VisualGDB)...
    SysprogsSuggestedActionsProvider: Creating a SuggestedActionsSource for E:\projects\temp\WindowsProject1\WindowsProject1.cpp...
    Creating a SuggestedActionsProvider for E:\projects\temp\WindowsProject1\WindowsProject1.cpp...
    No backend client found. Could not create the SuggestedActionsProvider

    If the log does not contain the “SysprogsSuggestedActionsProvider” part, the MEF-specific part of VisualGDB is not loaded. If the log shows errors (e.g. assembly resolution failures), your Visual Studio installation might be missing some components.

  4. You can also double-check if the rename smart tags are working for other project types (e.g. C#).

Resetting Cache

Sometimes, Visual Studio does not properly update the MEF cache after VisualGDB has been installed, resulting in MEF load failures. If this happens, follow the steps below to reset the Visual Studio caches:

  1. Delete the %LOCALAPPDATA%\Microsoft\VisualStudio\<Instance>\ComponentModelCache\*.cache files.
  2. Change the timestamp on the following files inside the C:\Program Files\Microsoft Visual Studio\<Version>\Common7\IDE\Extensions directory:
    1. extensions.configurationchanged
    2. clearcache.changed

If nothing helps, try installing any other extension via the Visual Studio Extension Manager. It should forcibly invalidate all extension-related caches.