I have Unity 2018.3.0f2 and Visual Studio 2017 15.9.4, with Visual Studio Tools for Unity 3.9.0.3. If I compile a managed DLL in VS, Unity will import and run code from it just fine, but I can’t debug it: breakpoints don’t work, exceptions don’t have callstacks, etc. VS complains that no symbols are loaded, even though the VS solution is built in full debug and the corresponding .pdb file is present.
Digging into it, I find lots of references to using a pdb2mdb.exe tool to convert .pdb files (VS style) to .mdb files (mono style). If I run this tool manually then I can debug, but I have to re-run it manually after every time I rebuild the DLL with changes. I could put it in a post-build step easily enough, but I’m really curious why I have to do any of this at all, especially because other people (including people on my own team) seem to just not have this problem?
Furthermore, running the pdb2mdb.exe works fine on Windows, but I can’t run it on Mac. Visual Studio for Mac also generates .pdb files, but when I try to run the pdb2mdb.exe on Mac (via mono) it complains that “A portable PDB can’t be converted to mdb.” The generated .pdb should not be “portable”, it should be “full” per the debug symbol settings in Visual Studio. And yet.
The main thing I keep seeing over and over in my research is that either Unity or the VSTU plugin (it’s unclear which) are supposed to auto-convert .pdb to .mdb for me and I’m not supposed to have to think about any of this… but that just isn’t happening. There aren’t any error messages or anything, it just flat-out doesn’t do the thing. At all.
Some Unity documentation even seems to suggest that just having the .pdb should be enough to debug, and the .mdb doesn’t even get mention. So what gives? Because that is definitely not working for me, under any circumstances.
I’m kinda at my wit’s end here. What am I missing?
Have a project where .dlls are copied over into unity land in our post builds. Sometimes .mdbs generate/update. Sometimes they don’t. Created a .bat script to run pdb2mdb.exe against all of our .dlls and it seems to work every time (able to debug/breakpoint after doing it, and able to see all the .mdbs update in windows explorer). But now looking for a way to not have to manually click this .bat everytime I want to debug.
I got info from Unity’s @superpig that new scripting runtime supports pdb debugging instead of mdb. That’s ok and superb but unfortunately when I attach VS 2019 to Unity 2019.2.15, sysmbols (pdb) aren’t loaded so I can’t debug them.
I have found similar reports. I’ll link them here for future reference.