简体   繁体   English

无法调试 Systems.Windows.Forms.Control(未找到 PDB 文件)

[英]Cannot debug Systems.Windows.Forms.Control (PDB file not found)

I try to debug a problem, where the Size property of a Panel is overwritten by an unknown source.我尝试调试一个问题,其中 Panel 的 Size 属性被未知来源覆盖。 I did not find any self written code in the project, that directly accesses this property, so there has to be some underlying code, that is called and changes it.我在项目中没有找到任何直接访问此属性的自写代码,因此必须有一些底层代码,即调用并更改它。

To find out, where the overwrite comes from I tried to set a Breakpoint in the setter method of the Size property in System.Windows.Forms.Control.cs: Control class .为了找出覆盖的来源,我尝试在System.Windows.Forms.Control.cs: Control classSize propertysetter method中设置断点。 But upon starting the Application Visual Studio disables the breakpoint and displays a warning, that this breakpoint won't be reached, since no symbols were loaded.但是在启动应用程序时,Visual Studio 会禁用断点并显示警告,即不会到达此断点,因为没有加载任何符号。 I confirmed in the Modules Window of the Debugger, that the System.Windows.Forms module was loaded but not its symbols.我在调试器的模块窗口中确认System.Windows.Forms模块已加载,但未加载其符号。 There was an error, that the PDB file could not be found or opened, so I rightcliked the entry and provided the PDB file manually.出现错误,无法找到或打开 PDB 文件,因此我右键单击该条目并手动提供 PDB 文件。 Afterwards inside the modules window, it was stated, that symbols were loaded, but in the Controls.cs file the breakpoint was still disabled due to no loaded symbols.之后在模块窗口中,说明已加载符号,但在Controls.cs文件中,由于未加载符号,断点仍被禁用。

In the Debugger section of the options I made sure, that:在我确定的选项的调试器部分中:

  • Only my Code is turned off只有我的代码被关闭
  • Debug .NET Framework Sourcecode is enabled调试 .NET Framework 源代码已启用
  • Sourceserver assistance is enabled源服务器协助已启用
  • Sourcecode files have to match exactly is disabled源代码文件必须完全匹配被禁用

I also tried the Load all Symbols button in the symbols section, but still can't debug the System.Windows.Forms.Controls.cs file.我还尝试了符号部分中的Load all Symbols按钮,但仍然无法调试System.Windows.Forms.Controls.cs文件。

Since the application runs on NET Framework 4.7.2 data breakpoints aren't available and since the Size class is sealed I can't create my own copy of it to overwrite the set method to break in there.由于应用程序在NET Framework 4.7.2上运行,数据断点不可用,并且由于Size classsealed的,因此我无法创建自己的副本来覆盖set方法以进入其中。

Does anybody know how to provide VS2022 with an according PDB file or any other way of checking where the overwrite of the property comes from?有谁知道如何为 VS2022 提供相应的 PDB 文件或任何其他检查属性覆盖来自何处的方法?

We can see from this link that “To debug a crash that occurs during a call to a system DLL or to a third-party library, you often need system .pdb files.”我们可以从这个链接中看到“要调试在调用系统 DLL 或第三方库期间发生的崩溃,您通常需要系统 .pdb 文件。” You can refer to the following steps to use the Microsoft Symbol Servers:您可以参考以下步骤来使用 Microsoft 符号服务器:

  1. Open Tools > Options > Debugging > Symbols打开工具 > 选项 > 调试 > 符号在此处输入图像描述
  2. Check “Microsoft Symbol Servers”.检查“Microsoft 符号服务器”。

The link above can give you more information about the issue.上面的链接可以为您提供有关该问题的更多信息。

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

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