- Home /
pdb2mdb.exe not working on Visual Studio 2015
I'm trying to setup DLL debuging for DLLs compiled in Visual Studio 2015. The target is .Net 3.5 and DLLs can work in Unity 5.1.2f1. I've tried all of the following command lines to try and convert the pdb to mdb, but none of them are working.
"C:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0\pdb2mdb.exe" DLLTest.dll
"C:\Program Files\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\pdb2mdb.exe" DLLTest.dll
"C:\Program Files\Unity\Editor\Data\MonoBleedingEdge\bin\cli.bat" "C:\Program Files\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\pdb2mdb.exe" DLLTest.dll
Here is the error for each of them.
Fatal error:
Microsoft.Cci.Pdb.PdbDebugException: Unknown custom metadata item kind: 6
at Microsoft.Cci.Pdb.PdbFunction.ReadCustomMetadata(BitAccess bits)
at Microsoft.Cci.Pdb.PdbFunction..ctor(String module, ManProcSym proc, BitAcc
ess bits)
at Microsoft.Cci.Pdb.PdbFunction.LoadManagedFunctions(String module, BitAcces
s bits, UInt32 limit, Boolean readStrings)
at Microsoft.Cci.Pdb.PdbFile.LoadFuncsFromDbiModule(BitAccess bits, DbiModule
Info info, IntHashTable names, ArrayList funcList, Boolean readStrings, MsfDirec
tory dir, Dictionary`2 nameIndex, PdbReader reader)
at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, BitAccess bits, Boole
an readAllStrings)
at Pdb2Mdb.Driver.Convert(AssemblyDefinition assembly, Stream pdb, MonoSymbol
Writer mdb)
I also tried it after following the instructions at this link, but it doesn't seem to help. Are there any fixes for these errors, or is there another way to debug DLLs compiled in VS2015?
Answer by yoyobbi · May 11, 2016 at 11:06 PM
Installation instructions for Visual Studio Tools For Unity are here. In theory VSTU should automatically convert PDB files to MDB format when the corresponding DLL is imported into Unity. However, you need to enable Visual Studio 2015 as your external script editor for this to work -- and even then I have found it to be inconsistent, and that it doesn't always do the conversion for all imported DLL's.
The workaround is to use this version of pdb2mdb.exe, provided by the author of Visual Studio Tools For Unity. It would be nice if Microsoft would provide this directly with VSTU, but at least it worked, or it did for me. Note that this updated version supports Visual Studio 2015 and is backwards-compatible with 2013.
Thanks, this worked! I wish there was a warning that pdb2mdb does not work with visual studio 2015... Or maybe they could update it when you install visual studio 2015 tool for unity
I came back to this issue a few months later after updating to Unity 5.5 and Visual Studio 2017RC at work. Your solution still works. Funny thing is, I had entirely forgot about ever having this issue but found your answer with my own comment under it, tried it and it worked :D As I couldn't upvote you again as you deserved I awarded you some points ins$$anonymous$$d :) Thanks for saving me hours of frustration, again!