Debug dynamically loaded assembly

前端 未结 2 848
忘掉有多难
忘掉有多难 2021-01-05 03:02

I am debugging an assembly which I loaded dynamically with Assembly.Load(Byte[]), but I am facing some problems.

First of all, I can\'t move the yellow arrow in Vis

相关标签:
2条回答
  • 2021-01-05 03:17

    The debug symbols for your assembly are not being loaded into the application domain. When you use the string variety, .NET automatically looks for a .PDB alongside the filename you specify.

    To load an assembly and its symbols from byte arrays, use Assembly.Load(byte[], byte[]), like so:

    Dim data = My.Computer.FileSystem.ReadAllBytes(file.FullName)
    Dim pdbData = My.Computer.FileSystem.ReadAllBytes(pdbFile.FullName)
    Assembly.Load(data, pdbData)
    
    0 讨论(0)
  • 2021-01-05 03:23

    When you pass it an array of bytes there's no way to know what file it comes from (or if it even comes from a file) so it can't locate the PDB file with the source code line information.

    You can fix this by saving the byte[] as a file and making sure there's a PDB for it with the same file name.

    0 讨论(0)
提交回复
热议问题