Following are common problems that you might have with your VSPackage and tips to resolve the issues.
To troubleshoot a VSPackage that keeps Visual Studio from starting
Start Visual Studio in safe mode.
To start Visual Studio in safe mode, at a command prompt, type devenv.exe /safemode.
During this process no VSPackages are loaded except the VSPackages that are included with Visual Studio.
To troubleshoot a VSPackage that does not load
Make sure that you are using the registry root in which the VSPackage is registered to run, usually the experimental registry root.
For more information, see The Experimental Instance.
If the VSPackage is targeted to run in the experimental registry root, make sure that you are running the experimental version of Visual Studio.
To run the experimental version, type the following in a command window: devenv /rootsuffix exp.
Open the Output window of the instance of Visual Studio that is failing to load the VSPackage. Information about why the VSPackage is failing to load may be displayed in that window.
If you are starting the experimental version of Visual Studio from the Visual Studio integrated development environment (IDE), inspect the Output window of both versions.
Examine the activity log.
For more information, see How to: Use the Activity Log.
For more information about exceptions thrown by the IDE, click Exceptions on the Debug menu to enable the exceptions. In the Exceptions dialog box select the types of exceptions about which you want more information.
To troubleshoot a VSPackage that does not register
Make sure that the VSPackage assembly resides in a trusted location. RegPkg cannot register assemblies in an untrusted or partially trusted location, such as a network share in the default .net security configuration. Although a warning appears whenever a user creates a project in an untrusted location, the "do not show this message again" checkbox can prevent this warning from reoccurring.
To troubleshoot a command that is not visible or that generates an error when you click a command
Merge the new or changed menu commands and those already in the IDE by typing the following at the Visual Studio Command Prompt: devenv /rootsuffix Exp /setup.
Make sure that Visual Studio can find UI.dll for your VSPackage.
Find the CLSID of the VSPackage in the Packages section of the registry:
Verify that the path given by the SatelliteDll subkey is correct.
To troubleshoot a VSPackage that behaves unexpectedly
Set breakpoints in your code.
Good starting points for debugging are the constructor and the initialization method. You can also set breakpoints in the area you want to evaluate, such as a menu command. To enable breakpoints, you must run under the debugger.
On the Project menu, click Properties.
On the Property Pages dialog box, select the Debug tab.
In the Command line arguments box, type the root suffix of the development environment that your VSPackage targets. For example, to select the experimental build, type: /RootSuffix Exp.
On the Debug menu, click Start Debugging or press F5.
If you are debugging a project, create or load an existing instance of your project now.
Use the activity log.
Trace VSPackage behavior by writing information to the activity log at key points. This technique is especially useful when you run a VSPackage in a retail environment. For more information, see How to: Use the Activity Log.
Use public symbols.
To improve readability while debugging, you can attach symbols to the debugger.
From the Tools/Options menu, navigate to the Debugging/Symbols dialog box.
Add this Symbol file (.pdb) location:
To improve performance, specify a symbol cache folder, for example:
To troubleshoot a missing VSPackage or one of its dependencies
For managed code, make sure that the reference paths are correct.
On the Project menu, click Properties.
Select the References tab in the Property Pages dialog box and make sure all paths are correct. Alternatively, you can use the Object Browser to browse for the referenced objects.
For managed code, you can use the Fuslogvw.exe (Assembly Binding Log Viewer) to display the details of failed assembly loads.
For unmanaged code, find the CLSID of the VSPackage in the Visual Studio CLSID registry node:
Make sure that the InprocServer32 entry has the correct path of the VSPackage dll.