janos
janos

Reputation: 124648

How to debug a Visual Studio Package in a VSIX created in Visual Studio 2015

I'm not able to debug the simplest possible VS Package in the simplest possible VSIX Project.

Steps to reproduce:

  1. Create a VSIX project: File / New / Project / Extensibility / VSIX Project

  2. Add Visual Studio Package: right-click the project node in Solution Explorer and select Add / New Item / Extensibility / Visual Studio Package

  3. Open the newly created package file (VSPackage1.cs) and put a breakpoint on line 68, the first line of Initialize(), base.Initialize()

  4. Press F5 to start debugging

This launches an experimental instance of Visual Studio 2015, with the package installed (confirmed in Tools / Extensions and Updates...), but the breakpoint is disabled:

breakpoint disabled

The above steps are from the Getting Started guide (index.html) of a freshly created VSIX Project, so it should have worked.

Additional info:

All this seems to suggest that the VS Package is not getting initialized, though it is clearly installed. What am I missing? In case it's relevant, here's the source code of the VS Package, and here's the entire dummy project.

If you need more information, please let me know.

Upvotes: 5

Views: 1814

Answers (2)

Daniel McLaury
Daniel McLaury

Reputation: 4273

To supplement the other answer here, the solution to the OP's actual problem is:

Just ignore the message and don't worry about it. The symbols aren't loaded right now, but they'll be loaded by the time the breakpoint is ready to be hit.

Upvotes: 0

Sergey Vlasov
Sergey Vlasov

Reputation: 27880

VSPackages are loaded into Visual Studio only when their functionality is required. For example, a VSPackage is loaded when Visual Studio uses a project factory or a service that the VSPackage implements. This feature is called delayed loading, which is used whenever possible to improve performance.

To automatially load a package on VS startup, you typically add a ProvideAutoLoad attribute to your main package class.

See Loading VSPackages documentation for more details.

Upvotes: 3

Related Questions