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

I cannot debug the simplest possible VS package in the simplest possible VSIX project.

Steps to reproduce:

  • Create a VSIX Project: File / New / Project / Extensibility / VSIX Project

  • Add Visual Studio Package: Right-click the project node in Solution Explorer and select Add / New Item / Extensibility / Visual Studio Package

  • Open the newly created package file ( VSPackage1.cs

    ) and put a breakpoint on line 68, the first line Initialize()

    ,base.Initialize()

  • Click 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 ( index.html

) tutorial of a newly created VSIX project, so it should work.

Additional Information:

  • Solution Configuration Debug , Platform Any Processor
  • The project debug properties automatically have Run external program set to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe

    and Command line arguments set to/rootsuffix Exp

  • I set Copy Debug Symbols to Output Directory to True

    and after that the file projectname.pdb

    appeared correctly inbin\Debug

  • The file bin\Debug\projectname.vsix

    containsprojectname.pdb

  • The project is included in Assets in source.extension.vsixmanifest

    withType=Microsoft.VisualStudio.VsPackage

  • I tried to add the project to Assets in source.extension.vsixmanifest

    with Type=Microsoft.VisualStudio.MefComponent

    , but it didn't seem to have much effect. On the first run after that, the breakpoints were enabled but not removed. On the second and subsequent runs, the breakpoints returned to the disabled state during operation.
  • I tried to change the version in the manifest, but I noticed some effect.
  • I tried starting the experimental instance separately and linking it to the debugger, but it was the same as starting directly from F5

    , no difference.
  • I tried adding Console.WriteLine

    to method Initialize

    but couldn't find debug texts in the window Output

    .
  • I tried x86 platform instead of Any CPU but same result.
  • A colleague followed the same steps and got the same result, so it's probably not defined for my computer. (I invite everyone to follow the same steps and prove that I am wrong, or notice errors in my steps.)

This all seems to suggest that the VS package is not initializing, even though it is explicitly installed. What am I missing? In case it's relevant, here's the source code for the VS package and here's the entire dummy project.

If you need more information, please let me know.

+3


source to share


2 answers


VSPackages are loaded into Visual Studio only when their functionality is needed. For example, VSPackage is loaded when Visual Studio uses a factory project or service that VSPackage implements. This feature is called load latency and is used whenever possible to improve performance.

To automatically load a package when VS starts, you usually add the ProvideAutoLoad attribute to your main package class.



See Downloading VSPackages documentation for details .

+3


source


In addition to the other answer, here's a solution to the OP's actual problem:



Just ignore the message and don't worry about it. Symbols are not loaded right now, but they will be loaded by the time the breakpoint is ready to hit.

0


source







All Articles