Unable to debug VSIX project
Asked Answered
W

8

15

I'm trying to develop my first visual studio extensions project, I have VS10 SDK installed and was able to create a new project and can build it fine, however when I attempt to debug symbols are not loaded. I know that I can debug to VSIX project since I have downloaded a sample project online and it symbols are loaded and break points are being hit fine http://weshackett.com/2009/11/configure-vsix-project-to-enable-debugging/). So must be something specifically to do with the way I have created the VSIX project ( maybe !). One thing I do notice is that the dll and files aren't being copied over to the local "Application Data" area, only the manifest is being copied over, while for the sample project, all files are being copied over including the dll. I have compared project settings between both and they are both the same. I hope it makes sense, if I can provide any more detail then let me know...

Well answered 14/10, 2011 at 11:58 Comment(6)
symbols are not loaded for anything or just your code? Are you certain your code is actually being loaded (via a msg box or some other mechanism)?Ecru
HI, it seems the issue is even more basic than that, DLL compiled is not being copied to the Debug directory. I'm using the standard VSIX project template.Well
hate to ask but are you sure you're building debug?Ecru
I thought the same but definetly building in debug modeWell
Okay may have figured this out, copy to output directory property was set to don't copy by default, changed it now to Copy newer. Will investigate if this now means the files are copied to the App Data folder.Well
IF YOU ARE HAVING THIS ISSUE IN 2023 THEN DELETE YOUR PROJECT .VS FOLDER AND TRY AGAIN. TOOK ME FOREVER TO FIGURE THIS OUT.Lat
W
22

OK I managed to get it working. In order to do so, I had to unload the vsix project and edit the file as an XML document.

Either remove the following lines from the project file:

<IncludeAssemblyInVSIXContainer>
    false
</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>
    false
</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>
    false
</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>
    false
</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>
    false
</CopyOutputSymbolsToOutputDirectory>

or set them to true:

<IncludeAssemblyInVSIXContainer>
    true
</IncludeAssemblyInVSIXContainer>
<IncludeDebugSymbolsInVSIXContainer>
    true
</IncludeDebugSymbolsInVSIXContainer>
<IncludeDebugSymbolsInLocalVSIXDeployment>
    true
</IncludeDebugSymbolsInLocalVSIXDeployment>
<CopyBuildOutputToOutputDirectory>
    true
</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>
    true
</CopyOutputSymbolsToOutputDirectory>

or add them under the ... node if they don't exist.

Once I removed these lines and rebuilt the solution, the dll and pdb were copied now as expected to the bin\debug folder as well as to the "AppData\Local\Microsoft\VisualStudio\10.0Exp\Extensions\" folder.

Well answered 14/10, 2011 at 22:49 Comment(5)
OK found further links connected with the issue:connect.microsoft.com/VisualStudio/feedback/details/515487/…Well
#1779297Well
its 2019 and this did wonders for me In latest release of VS2019.Liver
Good suggestions but still not enough apparently. Completely ridiculous.Ollie
Unfortunately none of these suggestions on this topic seems to help anyhow, vsix debugging is completely messed up.Decongestant
A
11

Been there.. in VS-2019 I'm developing a VSIX Async which worked fine, however at a certain point, Visual Studio Experimental Version stopped loading my VSIX in debug mode.

I am not sure of the root cause, but it coincided with opening a second VSIX project template in the same solution of Visual Studio. Don't know if that has anything to do with the issue, but on the first run, I found both VSIX-es loaded into the Experimental version session. At that point, I closed and reset the Experimental Version. On the next runs, no VSIX seemed to be loaded into the Experimental Version, when debugging.. very frustrating !

The solution I found, fiddling around

  • close any instances of Visual Studio
  • reset the Visual Studio Experimental Version using the commandline tool in Start menu.
  • Open VS, load your VSIX solution
  • clean your VSIX solution
  • switch to Release mode (yes, do it..)
  • Rebuild Solution then run
  • on the Just my Code warning popup, choose Continue Debugging
  • The Experimental Version will now start with your VSIX ! it is loaded !
  • Release mode is not handy when debugging. Close the Exp version You will be back in your VSIX solution
  • Switch back to Debug mode
  • run again

For me, above sequence lets the problem disappear. VSIX is loaded as it should.

Adit answered 30/10, 2020 at 23:37 Comment(6)
Unbelievable, but I think this actually worked!Precess
rootsuffix was set right but VS-exp still did not load my VSIX. Above procedure solved my problem (2x) I'm not sure in what other situation it would work...Adit
Give this man a medal.Lat
@Lat most medals are to be refused.. on SO I prefer upvotes :pAdit
@Adit Why?..Lat
Vanity of vanities; all is vanity. This is one of my good answers on SO, i don't have many.Adit
D
4

I ran into something simular in Visual Studio 2017. The options described by @Rubans don't seem to be necessary (anymore?).

In your current build configuration (Most likely Debug), you need to make sure, that Deploy VSIX content to experimental instance for debugging is checked in the Vsix property page:

enter image description here

Dakotadal answered 17/10, 2018 at 8:53 Comment(2)
Thanks, but it doesn't work for me. It's enabled, but symbols are still not loaded. Any more ideas?Perforce
social.msdn.microsoft.com/forums/vstudio/en-US/… It helped in my case to disable this debugging option: 'Break when an exception crosses AppDomain or managed/native boundaries'Kiva
B
3

I had the same looking issue - debugging would start but wherever I would set a breakpoint I'd see it "useless" and with "breakpoint will not be hit" annotation. I checked all the stuff in the other answers here and then I found a "contributor guide" in one plugin project repository (permalink to specific version).

So what helped me was the following: open the project properties, and on the "Debug" tab ensure that:

  1. "Start action" is set to "Start external program" and the path matches the path to devenv.exe - such as "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe" - that's what it was by default.

  2. "Start options" had "command line arguments" set to /rootsuffix Exp - that was missing by default and I had to add it.

So once I added /rootsuffix Exp it would start working - next time I pressed F5 the breakpoints in the plugin code would work.

Blancablanch answered 4/12, 2019 at 14:0 Comment(2)
This was also the correct method for VSIX using VS2019Yeld
/rootsuffix Exp also fixed it for me using VS2022, thanks a lot!Bloomery
R
0

I have the same problem,And in visual studio 2019,the debug command run arguments is /rootsuffix Roslyn

I try to update project and rebuild;but it not work. Luckly, I find another way to debug it. That is unitTest. In the newest solution which created by the vsix template; It contains the uniteTests project.

In the testmethod,you can invoke VerifyCSharpc method to test Diagnostic,and invoke VerifyCSharpFix method to test Fix; when you debug the unitTest ,you can hit the right breakpoint

Rossierossing answered 25/12, 2019 at 16:41 Comment(0)
E
0

Accidentally found how to fix it in vs 2017 15.9.20

Shortly: uninstall your extension in new VS, re-run new VS by F5, then clean and rebuild solution, then run by F5 again.

When you re-run VS after uninstalling your extension, new VS "understands" that your extension was removed. After that you rebuild code and "put" it in new VS.

Detaily:

  • run F5, in new VS go to Extensions and uninstall your extension
  • close new VS
  • in opened Uninstall VSIX window - uninstall your extension
  • do not change anything, just re-run the code by F5, check that extension is removed in new started VS, close new VS
  • in your coding VS - clean Solution
  • rebuild
  • run by F5, enjoy
Exigent answered 20/10, 2020 at 11:3 Comment(0)
C
0

You can try reset Visual Studio Experimental (it works for me). Go to Start Menu -> Visual Studio 2019 -> Reset the Visual Studio 2019 Experimental Instance

(each visual studio version has its link)

Cards answered 24/2, 2022 at 16:14 Comment(0)
R
0

I had to do the following:

  1. Make sure that your Symbols Settings are properly configured enter image description here
  2. I had to bump the extension version. Just make it a higher number than what you have installed locally: enter image description here
Redound answered 18/4, 2022 at 8:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.