简体   繁体   中英

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. 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 . 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. I confirmed in the Modules Window of the Debugger, that the System.Windows.Forms module was loaded but not its symbols. 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. 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.

In the Debugger section of the options I made sure, that:

  • Only my Code is turned off
  • Debug .NET Framework Sourcecode is enabled
  • 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.

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.

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?

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.” You can refer to the following steps to use the Microsoft Symbol Servers:

  1. Open Tools > Options > Debugging > Symbols在此处输入图像描述
  2. Check “Microsoft Symbol Servers”.

The link above can give you more information about the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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