0

I followed all the instructions mentioned on the following page to enable native debugging. https://learn.microsoft.com/en-us/visualstudio/debugger/how-to-debug-managed-and-native-code?view=vs-2022. However Visual studio 2022 is still showing the error on placing breakpoint : "the breakpoint will not be currently hit, no symbols have been loaded for document"

Can someone please help what I could be missing?

Sameer Joshi
  • 329
  • 3
  • 16
  • Since no symbols have been loaded I suppose the first step must be to see if you have a symbols file for your dll (a *.pdb file, I think). Second step should be to see when you started your debugger whether you can see a message that symbols had or had not been loaded for your dll. I'm no expert but when you have an error like that you have to start diagnosing what step in the process might have gone wrong. It's not that case that you can tell immediately what is wrong from an error message. – john Jan 03 '23 at 06:48
  • Try a complete rebuild. I have seen cases where the debug info was somehow outdated. You do build with debug symbols, do you? – Sedenion Jan 03 '23 at 06:50
  • @john I tried all the steps you mentioned, still no progress. – Sameer Joshi Jan 03 '23 at 07:49
  • @SameerJoshi So the questions are 1) Did you find the .pdb file? 2) Did you see a message from the debugger about loading or not loading symbols for your dll? We can't help you unless you provide information. Just saying 'it doesn't work' does not help. – john Jan 03 '23 at 07:58
  • @john 1. I see the pdb file is present in the same directory inside Output/bin/x64/debug where the exe is present. 2. I see that the debugger is not referring to loading the symbols for the native DLLs in the code, though I can see the functions in the native code DLLs are getting called. – Sameer Joshi Jan 03 '23 at 08:42
  • @SameerJoshi So I think the problem is that you are supposed to be building a DLL, not an exe. In your tutorial is says 'Create a simple native DLL'. – john Jan 03 '23 at 09:11
  • @john After doing clean build twice somehow it started working. – Sameer Joshi Jan 03 '23 at 09:18
  • @john Native code was being built as DLL that is linked with C# code that is built as an exe. – Sameer Joshi Jan 03 '23 at 09:19
  • @SameerJoshi OK, but the problem is (was) the pdb file associated with the DLL, so that was the pdb file I was asking about. – john Jan 03 '23 at 09:50
  • @SameerJoshi, Do you mean that you have resolved this issue? There are two mixed-mode debugging scenarios, maybe it could also provide help. https://learn.microsoft.com/en-us/visualstudio/debugger/how-to-debug-in-mixed-mode?view=vs-2022 – Jack Zhai Jan 10 '23 at 09:50

0 Answers0