0

I'm trying to debug my code in Visual Studio but my Breakpoint is not hit,it's giving me this message "Breakpoints set but not yet bound" The breakpoint is in a project that is not set as StartUp Project because it is a library project, my controller calls the method by invocation, I also verified that the dll generated by the solution that contains the library is the same as the project added to my solution I've read various other questions and tried various solutions like closing VS, deleting bin and obj folders, clean and rebuild but I can't reach those brakpoints

Jiale Xue - MSFT
  • 3,560
  • 1
  • 6
  • 21
Marduk
  • 125
  • 2
  • 14
  • Are `DEBUG` and `TRACE` defined for the library project? – madmonk46 Nov 16 '22 at 08:35
  • 1
    are the pdb data generated? – DonMiguelSanchez Nov 16 '22 at 08:35
  • Yes pdb it's present – Marduk Nov 16 '22 at 08:38
  • `RELEASE` will still generate PDB files, at least with the default settings. Check for `DEBUG` and `TRACE` specifically. If they're present, there's a suggestion [here](https://learn.microsoft.com/en-us/answers/questions/265772/visual-studio-debugging-breakpoint-set-but-yet-bou.html) for an additional location of temporary files that might need to be removed. Depending on the type of project you're working with, this also could be an [existing issue](https://developercommunity.visualstudio.com/t/the-breakpoint-will-not-be-hit-breakpoint-set-but/675860) in Visual Studio. – madmonk46 Nov 16 '22 at 08:44
  • You could also try setting the class library project as the Startup Project, as described [here](https://stackoverflow.com/a/13742464/9796331). – madmonk46 Nov 16 '22 at 08:48
  • I tried all the suggested solutions, nothing changed – Marduk Nov 16 '22 at 15:52
  • What's the type of your project? Can you give more information to reproduce the problem? – Jingmiao Xu-MSFT Nov 17 '22 at 08:35

1 Answers1

0

You may have a few options to resolve your issue. First and recommended, your dll and exe project should be in the same solution and both in debug mode. If the projects are in separate solutions, set the breakpoint on the method call on the exe project side. Then pressing F11 should let you into your dll code. If you don't own the project or solution exe, you have the option in VS to link your dll to a running process, but you will only be able to link compiled binaries with managed code. For example, your dll could probably link to windows explorer, but any code will run as far as I know.