title: Create mdb file to debug managed DLL in Unity
body: <p>I'm trying to debug my managed DLL within Unity. It used to work fine on Unity 2018.x</p>
  
  <p>Now I have Unity 2019.3 and I can't debug anymore (my DLLs are working fine I just can't debug them).</p>
  
  <p>My DLL and its pdb file are in the Assets folder. That used to be enough to be able to debug them.</p>
  
  <p>Reading this documentation : <a href="https://docs.unity3d.com/Manual/UsingDLL.html" rel="nofollow noreferrer">https://docs.unity3d.com/Manual/UsingDLL.html</a>, I'm trying to create the mdb file.</p>
  
  <p>First issue, the documentation says I have to pass the .pdb file as a parameter while most links on google say to pass the .dll</p>
  
  <p>This link also states that I should change the working directory of my .bat file to be able to use pdb2mdb.exe : <a href="https://answers.unity.com/questions/294195/pdb2mdb-usage-error-from-command-line.html" rel="nofollow noreferrer">https://answers.unity.com/questions/294195/pdb2mdb-usage-error-from-command-line.html</a></p>
  
  <p>Here is my code:</p>
  
  <pre><code>set PathToLib="Libraries\"
  if exist Libraries\LibBDD.dll  (
      echo Before switching directory for my lib %CD%
      cd %PathToLib% 
      echo new directory %CD%
      @pause
      "C:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0\pdb2mdb.exe" LibBDD.dll
  
      @pause
      cd ..\..\..\..\..\
      echo LibBDD done, new directory %CD%
      )
  </code></pre>
  
  <p>First of all I'm not sure if my CD command is working since the path remains the same. But I don't get any exception.</p>
  
  <p>With this code I get:</p>
  
  <blockquote>
    <p>Fatal error: Microsoft.Cci.Pdb.PdbDebugException: Unknown custom
    metadata item kind: 6    à
    Microsoft.Cci.Pdb.PdbFunction.ReadCustomMetadata(BitAccess bits)    à
    Microsoft.Cci.Pdb.PdbFunction..ctor(String module, ManProcSym proc,
    BitAccess bits)    à
    Microsoft.Cci.Pdb.PdbFunction.LoadManagedFunctions(String module,
    BitAccess bits, UInt32 limit, Boolean readStrings)    à
    Microsoft.Cci.Pdb.PdbFile.LoadFuncsFromDbiModule(BitAccess bits,
    DbiModuleInfo info, IntHashTable names, ArrayList funcList, Boolean
    readStrings, MsfDirectory dir, Dictionary`2 nameIndex, PdbReader
    reader)    à Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read,
    BitAccess bits, Boolean readAllStrings)    à
    Pdb2Mdb.Driver.Convert(AssemblyDefinition assembly, Stream pdb,
    MonoSymbolWriter mdb)</p>
  </blockquote>
  
  <p>Without the CD I get:</p>
  
  <blockquote>
    <p>Mono pdb to mdb debug symbol store converter Usage: pdb2mdb assembly</p>
  </blockquote>
  
  <p>I'm using Visual Studio 2019 Community.</p>
  
  <p>I'm not sure what I am doing wrong and why I can't debug anymore in Unity. I've tried to add the csproj to the solution in VS but it doesn't do the trick anymore, the symbols are not loaded.</p>