Troubleshoot issues with VSPackages
Applies to: Visual Studio
This article introduces common issues and troubleshooting tips with your VSPackages.
A VSPackage keeps Visual Studio from starting
In this scenario, start Visual Studio in safe mode by entering devenv.exe /safemode at a command prompt. During this process, no VSPackages are loaded except the VSPackages that are included with Visual Studio.
A VSPackage isn't loaded
To troubleshoot this issue, try one or more of the following steps:
Make sure that you're 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're running the experimental version of Visual Studio.
To run the experimental version, open a Visual Studio Command Prompt and then enter devenv /rootsuffix exp.
Check your VSPackage registry entries. For more information, see Registering VSPackages and Managing VSPackages.
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.
Note
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, select 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.
A VSPackage isn't registered
Make sure that the VSPackage assembly resides in a trusted location. RegPkg can't 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.
A command isn't visible or it generates an error when it's selected
To solve this issue, try the following steps:
Merge the new or changed menu commands and those commands already in the IDE by entering devenv /rootsuffix Exp /setup at the Visual Studio Command Prompt.
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:
HKLM\Software\Microsoft\Visual Studio\<version>\Packages
Verify that the path given by the SatelliteDll subkey is correct.
A VSPackage behaves unexpectedly
To troubleshoot this issue, try one or more of the following steps:
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, select Properties.
On the Property Pages dialog box, select the Debug tab.
In the Command line arguments box, enter the root suffix of the development environment that your VSPackage targets. For example, to select the experimental build, enter: /RootSuffix Exp.
On the Debug menu, select Start Debugging or press F5.
Note
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 Symbol file (.pdb) location:
https://msdl.microsoft.com/download/symbols
. - To improve performance, specify a symbol cache folder, for example: C:\symbols.
A VSPackage or one of its dependencies is missing
For managed code, make sure that the reference paths are correct.
On the Project menu, select 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:
HKLM\Software\Microsoft\Visual Studio\<version>\CLSID
Make sure that the InprocServer32 entry has the correct path of the VSPackage DLL.
References
Feedback
https://aka.ms/ContentUserFeedback.
În curând: Pe parcursul anului 2024, vom elimina treptat Probleme legate de GitHub ca mecanism de feedback pentru conținut și îl vom înlocui cu un nou sistem de feedback. Pentru mai multe informații, consultați:Trimiteți și vizualizați feedback pentru