简体   繁体   English

调试 Visual Studio 扩展时,.pdb 文件不可用

[英].pdb files not available when debugging Visual Studio Extension

[Environment: W10 x64 Pro v. 20H2, Visual Studio Pro 2019 16.9.4] [环境:W10 x64 Pro v. 20H2,Visual Studio Pro 2019 16.9.4]

I am attempting to debug an open source project, which is a Visual Studio Extension ( AnkhSVN2019 ) and am able to start a VS Extension Debug session where my modified code is being executed.我正在尝试调试一个开源项目,它是一个 Visual Studio 扩展( AnkhSVN2019 ),并且能够启动一个 VS 扩展调试 session 正在执行我修改的代码的地方。

However, any breakpoints I set in the code are disabled at runtime, and when I mouse over the disabled breakpoint, I get the message但是,我在代码中设置的任何断点在运行时都被禁用,当我将鼠标悬停在禁用的断点上时,我会收到消息

The breakpoint will not currently be hit. No symbols have been loaded for this document.

When I am in the debug session, and I open the Modules window (Debug -> Windows -> Modules), I see that my dll I am interested in is loaded and located at c:\users\conrad\appdata\local\microsoft\visualstudio\16.0_b1ddb83bexp\extensions\extensions-16.0_b1ddb83b\wyo52n3q.czx\Ankh.UI.dll . When I am in the debug session, and I open the Modules window (Debug -> Windows -> Modules), I see that my dll I am interested in is loaded and located at c:\users\conrad\appdata\local\microsoft\visualstudio\16.0_b1ddb83bexp\extensions\extensions-16.0_b1ddb83b\wyo52n3q.czx\Ankh.UI.dll (It is indeed there.) There is no Ankh.UI.pdb in that directory though. (确实存在。)但该目录中没有Ankh.UI.pdb Some hopefully relevant observations:一些希望相关的观察结果:

  • The file Ankh.UI.pdb does exist in the ...\bin\Debug\ dir of the project文件Ankh.UI.pdb确实存在于项目的...\bin\Debug\目录中
  • The timestamp for the above Ankh.UI.dll is older than recent edits I have made to files within that.dll上述 Ankh.UI.dll 的时间戳比我最近对其中的文件所做的编辑要旧。dll
  • Looking around, I see there is an updated Ankh.UI.dll in C:\Users\conrad\AppData\Local\Microsoft\VisualStudio\16.0_b1ddb83bExp\Extensions\Phil Jollans\AnkhSVN2019\1.0.12\ but no.pdb files in that dir either (Phil Jollans is the owner of AnkhSVN2019 on github)环顾四周,我看到在C:\Users\conrad\AppData\Local\Microsoft\VisualStudio\16.0_b1ddb83bExp\Extensions\Phil Jollans\AnkhSVN2019\1.0.12\中有一个更新的 Ankh.UI.dll那个目录(Phil Jollans 是 github 上 AnkhSVN2019 的所有者)

Back in the Modules window, if I right-click on the Ankh.UI.dll line and choose Symbol Load Information… , a dialog opens with the following information:回到Modules window 中,如果我右键单击 Ankh.UI.dll 行并选择Symbol Load Information... ,将打开一个包含以下信息的对话框:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Ankh.UI.pdb: Cannot find or open the PDB file.
c:\users\conrad\appdata\local\microsoft\visualstudio\16.0_b1ddb83bexp\extensions\extensions-16.0_b1ddb83b\wyo52n3q.czx\Ankh.UI.pdb: Cannot find or open the PDB file.
C:\AnkhSVN2019\src\Ankh.UI\obj\x86\Release\Ankh.UI.pdb: Cannot find or open the PDB file.
C:\Windows\Ankh.UI.pdb: Cannot find or open the PDB file.
C:\Windows\symbols\dll\Ankh.UI.pdb: Cannot find or open the PDB file.
C:\Windows\dll\Ankh.UI.pdb: Cannot find or open the PDB file.

(btw there is no C:\AnkhSVN2019\ directory.) (顺便说一句,没有C:\AnkhSVN2019\目录。)

What am I missing here?我在这里想念什么?

I have download this project, but how do you debug this project?我已经下载了这个项目,但是你如何调试这个项目?

I use below steps to debug it, the breakpoint(Ankh.UI) can be hit, and Ankh.UI pdb file can be loaded.我使用下面的步骤来调试它,可以打断点(Ankh.UI),并且可以加载 Ankh.UI pdb 文件。 在此处输入图像描述

  1. Right-click the Ankh.Package project右键单击Ankh.Package项目
  2. Open Debug page打开Debug页面
  3. Change Start Action to Start external program with "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe"Start Action更改为使用“C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe” Start external program
  4. Add /rootsuffix Exp in Command line arguments在命令行 arguments 中添加/rootsuffix Exp

Got this list of sufficient (although maybe not completely necessary) steps from the Extension owner to get my environment in a state where the Extension is debuggable:从扩展所有者那里获得了足够(尽管可能不是完全必要)步骤的列表,以便在扩展可调试的 state 中获取我的环境:

  • start the experimental instance (in the debugger)启动实验实例(在调试器中)
  • remove AnkhSVN from the experimental instance (via Extensions/Manage Extensions)从实验实例中删除 AnkhSVN(通过扩展/管理扩展)
  • close the experimental instance关闭实验实例
  • remove AnkhSVN from the normal instance从普通实例中删除 AnkhSVN
  • close visual studio关闭视觉工作室
  • in the start menu, click the Reset Visual Studio 2019 Experimental Instance link在开始菜单中,单击重置 Visual Studio 2019 Experimental Instance链接
  • open AnkhSVN in visual studio again再次在 Visual Studio 中打开 AnkhSVN
  • clean the solution清洁溶液
  • start the debugger (which will rebuild the solution – do not build the solution first!)启动调试器(它将重新构建解决方案——不要先构建解决方案!)
  • if it doesn't install AnkhSVN into the experimental instance, then close it and start the debugger again如果它没有将AnkhSVN安装到实验实例中,则关闭它并再次启动调试器

This list of steps is IMO completely crazy and shouldn't be necessary to debug an Extension.这个步骤列表是 IMO 完全疯狂的,不应该是调试扩展所必需的。 Can't tell if this is a VS shortcoming or due to the Extension being poorly architected.无法判断这是 VS 的缺点还是由于扩展架构不佳。 But at least now I can debug it.但至少现在我可以调试它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM