HOWTO: Using the Process Monitor (ProcMon) tool to diagnose Visual Studio add-ins problems

Author: Carlos J. Quintero (Microsoft MVP) Applies to: Microsoft Visual Studio .NET 2002
Date: September 2008   Microsoft Visual Studio .NET 2003
Updated: March 2013   Microsoft Visual Studio 2005
      Microsoft Visual Studio 2008
      Microsoft Visual Studio 2010
      Microsoft Visual Studio 2012

This article explains how to use the Process Monitor tool to diagnose add-ins problems. The Process Monitor tool was developed by SysInternals, a company later adquired by Microsoft, and now is supplied by Microsoft Technet:

Process Monitor

The Process Monitor tool allows you to spy Registry, File System and Process and Thread activity, and superceedes the old Registry Monitor and File Monitor tools.

More Information

The Process Monitor tool allows you to diagnose add-ins problems in the following areas:

  • Setups failing to install or register an add-in
  • Visual Studio failing to recognize an add-in in the Add-In Manager
  • Add-ins failing to work properly without admin rights (for example in Windows Vista)

The Process Monitor tool allows you get a trace of all the Registry or File System activity of a process, so it can provide an invaluable information to guess why an add-in is failing.

To use the tool:

  • Download and unzip the tool.
  • Run the tool (ProcMon.exe) with admin rights (on Windows Vista and higher, right-click the "Run as administrator" context menu).
  • When the tool is launched, the Process Monitor Filter dialog window is shown, to allow you to filter the process that you want to monitor. Since there is a lot of activity from processes in a Windows operating system, it is convenient to filter just the process that your are interested in, such as the setup of your add-in, the regsvr32.exe process, the Visual Studio process (devenv.exe), etc. You filter a process using conditions such as "Process Name is <value> then Include" or "Process Name is not <value> then Exclude". Notice that, by default, Process Monitor sets filters to exclude itself and the System process.
  • You can set a filter at any time using the "Filter", "Filter..." menu, but it is preferable to set it at startup.
  • For the example of this article, to diagnose a problem where Visual Studio fails to recognize an add-in in the Add-In Manager, you would set a filter like "Process Name is not devenv.exe then Exclude".
  • Once you have set the filter, you can select in the toolbar which events to show through the toggle buttons "Show Registry Activity", "Show File System Activity" and "Show Process and Thread Activity". For the example of this article, just keep checked the "Show File System Activity" button.
  • To start/stop the capture of events you check/uncheck the "File", "Capture Events" menu (Control + E).
  • To clear the display you click the "Edit", "Clear Display" menu (Control + X).
  • To export the results to a file you can use the "File", "Save..." menu. You can export to a .csv file to import it in Excel, for example.
  • For the example of this article, we will discover why Visual Studio 2008 doesn't recognize add-ins registered with an .AddIn XML file stored in the folder "%ALLUSERSDOCUMENTS%\Microsoft\MSEnvShared\AddIns" that appears in the "Tools", "Options" window, "Environment", "Add-in\Macros Security" section and that was introduced by Visual Studio 2008 (it didn't exist in Visual Studio 2005). See the article INFO: Default .AddIn file locations for Visual Studio add-ins. When Process Monitor is configured and capturing events with the filter set, just open Visual Studio 2008 and open the "Tools", "Add-In Manager" window. At this point stop capturing events in the Process Monitor tool.
  • You get a long trace of file system activity. Buried in the middle of the trace you will find the following entries:
Sequence Time of Day Process Name PID Operation Path Result Detail
34083 24:28,4 devenv.exe 2780 CreateFile C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\%ALLUSERSDOCUMENTS%\Microsoft\MSEnvShared\Addins\ PATH NOT FOUND ...
34084 24:28,4 devenv.exe 2780 CreateFile C:\Documents and Settings\All Users\Application Data\Microsoft\MSEnvShared\AddIns SUCCESS ...
34085 24:28,4 devenv.exe 2780 QueryDirectory C:\Documents and Settings\All Users\Application Data\Microsoft\MSEnvShared\AddIns\*.addin SUCCESS ...

As you can see, while Visual Studio 2008 correctly scans the "C:\Documents and Settings\All Users\Application Data\Microsoft\MSEnvShared\AddIns" folder searching for .addin files, it fails to replace correctly the %ALLUSERSDOCUMENTS% placeholder (somehow it uses the unrelated "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE" folder) and therefore it won't find .addin files stored in that folder.

Go to the 'Visual Studio Extensibility (VSX)' web site for more articles like this (Articles section)