How can I remotely debug a C# .NET 4.5 WinForms application on a Raspberry Pi 3 using Visual Studio 2015?
<p>I am attempting to remotely debug a C# .NET 4.5 WinForms application on a Raspberry Pi 3 (running Raspbian Jessie) using Visual Studio 2015 on a Windows machine.</p>

<p>As I understand it, I can use <a href="https://github.com/techl/MonoRemoteDebugger" rel="nofollow">MonoRemoteDebugger</a> for this. I've installed the Visual Studio extension and run the server program on the Pi but when I attempt to debug the application the MonoRemoteDebugger.Server.exe program displays an error which comes from the pdb2mdb.exe program. Here is the error:</p>

<blockquote>
  <p>Fatal error: Microsoft.Cci.Pdb.PdbDebugException: Unknown custom
  metadata item kind: 6   at
  Microsoft.Cci.Pdb.PdbFunction.ReadCustomMetadata
  (Microsoft.Cci.Pdb.BitAccess bits) [0x00000] in :0<br>
  at Microsoft.Cci.Pdb.PdbFunction..ctor (System.String module,
  ManProcSym proc, Microsoft.Cci.Pdb.BitAccess bits) [0x00000] in
  :0    at
  Microsoft.Cci.Pdb.PdbFunction.LoadManagedFunctions (System.String
  module, Microsoft.Cci.Pdb.BitAccess bits, UInt32 limit, Boolean
  readStrings) [0x00000] in :0    at
  Microsoft.Cci.Pdb.PdbFile.LoadFuncsFromDbiModule
  (Microsoft.Cci.Pdb.BitAccess bits, Microsoft.Cci.Pdb.DbiModuleInfo
  info, Microsoft.Cci.Pdb.IntHashTable names,
  System.Collections.ArrayList funcList, Boolean readStrings,
  Microsoft.Cci.Pdb.MsfDirectory dir,
  System.Collections.Generic.Dictionary`2 nameIndex,
  Microsoft.Cci.Pdb.PdbReader reader) [0x00000] in :0 
  at Microsoft.Cci.Pdb.PdbFile.LoadFunctions (System.IO.Stream read,
  Microsoft.Cci.Pdb.BitAccess bits, Boolean readAllStrings) [0x00000] in
  :0    at Microsoft.Cci.Pdb.PdbFile.LoadFunctions
  (System.IO.Stream read, Boolean readAllStrings) [0x00000] in :0    at Pdb2Mdb.Driver.Convert (Mono.Cecil.AssemblyDefinition
  assembly, System.IO.Stream pdb,
  Mono.CompilerServices.SymbolWriter.MonoSymbolWriter mdb) [0x00000] in
  :0</p>
</blockquote>

<p>I've tried running the command "pdb2mdb MyProgram.exe" on the Pi and it produces the same error so it appears that the issue is with the pdb2mdb.exe program. With some digging I found that it appears that this was a bug in Mono.Cecil which <a href="https://github.com/jbevain/cecil/issues/186" rel="nofollow">was fixed</a> in version 0.9.6 but it seems like the latest version available for Raspian Jessie is 0.9.5.</p>

<p>I've tried just replacing pdb2mdb.exe with <a href="https://gist.github.com/jbevain/ba23149da8369e4a966f" rel="nofollow">the one from here</a> and the error then changes to:</p>

<blockquote>
  <p>Unhandled Exception: System.TypeLoadException: Could not load type
  'Mono.Cecil.AssemblyDefinition' from assembly 'pdb2mdb,
  Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. [ERROR] FATAL
  UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type
  'Mono.Cecil.AssemblyDefinition' from assembly 'pdb2mdb,
  Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.</p>
</blockquote>

<p>Is the solution to try to get a newer Mono.Cecil version on the Pi? If so, how would I go about that, as well as ensure that pdb2mdb.exe references the newer version?</p>