When doing “Attach Unity Debugger” and running some breakpoints are not functional in some scripts but they are in others. So the debugger information is missing for these scripts, but why?
Using visual studio to attach to a process has taught met that corresponding .pdb files should be found for each .dll file but here it seems we have this information in assemblies instead [Assembly-CSharp-firstpass, Assembly-CSharp, Assembly-CSharp-Editor-firstpass] But looking in them does not give me any clue.
However, looking in the Debug/Windows/Modules says that the symbols for these are loaded so everything should be fine. But it is not because, as mentioned, only some scripts support adding functional breakpoints (they work, are solidly read and not empty etc).
I have of course tried the standard of deleting the library folder etc to have everything regenerated. I have also upgraded to the latests LTS (2022.3.58f1, before Unity 6) and so on.
Sometimes the connection just breaks. Other times the information the IDE has about the project may be out of sync. Just as Unity has “delete Library folder” there are equivalent data-wipes for VS. In Rider, there is a menu option to clear caches and such which I sometimes have to do for that very reason, or when code analysis stops working.
The other cause could be that the particular code never actually runs. So be sure to confirm that.
Thanks for the response. Rider might be something to try out if it works better for debugging. However, I will spend some more time trying to understand how the .pbd file information is stored/transferred. I also tried to attach to process (running the game and attaching to the process) instead of using the built in option that directly attaches to the game. It should work since there are options in the Build setup to export .PBD files etc to the destination folder. But that did not work at all - I mean then no breakpoints at all were functional which is strange since that has worked in the past for other C# developed programs.
Debugger not connecting or breakpoints not triggering is unlikely to be connected with PDB. The PDB in essence simply puts the names and line information back into the compiled code. You can debug code without a PDB (debug symbols) but it will be more cryptic.