0

I have a VS 2022 solution with a WPF client and ASP.NET backend and when I put breakpoints in the backend web services they have the yellow tag with a message:

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

I run the solution with the WPF project set as the start project, but, if I test this by setting the web project as the start project - the symbols will load, but of-course this is useless as the wpf app is not running.

A little history: This solution was running on my old dev PC (same version of everything) and all worked as expected, but when loading all solutions onto my new PC, this problem started up. I have googled this and found a ton of posts about it and have tried everything, but nothing has worked yet.

I can run the solution and attach to the process and then debug, but since I will be debugging 100s and 100s of times, those extra steps are a real pain and I have been able to debug asp.net projects from wpf for many years up to now.

Can someone please recommend some additional steps I can take to solve this problem?

FYI, I Have been through everything from this link:

How do I remedy "The breakpoint will not currently be hit. No symbols have been loaded for this document." warning?

Thanks.

spacedog
  • 446
  • 3
  • 13
  • Where are you expecting the web service run? If its on your pc then is the step you're missing starting multiple projects? https://learn.microsoft.com/en-us/visualstudio/ide/how-to-set-multiple-startup-projects?view=vs-2022 – Andy Jan 17 '23 at 14:10
  • Thanks @Andy and yest I tried that. I tried stepping from the client to the server as well but it skips the server side code - can't hit break points on the server. – spacedog Jan 17 '23 at 15:57
  • Iis express? Do you see it start up? You should see it appear off your task bar. – Andy Jan 17 '23 at 18:14
  • An alternative is to open up Vs twice. Start the web service in one and Wpf in the other. If you try running just the web api what happens with your break points? I would expect a web sln and Wpf sln really. Bit odd you've got them in one. – Andy Jan 17 '23 at 18:20

1 Answers1

1

Common method:

In VS, go to Tools --> Options --> Debugging --> General, and then cancel the checks in front of [Enable "Only My Code"] and [Require source files to exactly match the original version]. But this method you may have tried.

Ultimate method:

When the breakpoints clicked by the mouse are invalid, you can perform the following operations in vs: Debug --> delete all breakpoints Debug --> New Breakpoint --> Function Breakpoint, and then enter the name of the function to add a breakpoint

enter image description here

enter image description here

wenbingeng-MSFT
  • 1,546
  • 1
  • 1
  • 8