调试动态加载的程序集 [英] Debug dynamically loaded assembly

查看:279
本文介绍了调试动态加载的程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我调试,我动态加载的的Assembly.Load(字节[]),但我面临的一些问题。

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

首先,我不能动的黄色箭头在Visual Studio 2010中步入其他线路的code,而且我getiing异常(无法找到对象实例的方法。)时,尝试做一个快速监视的对象从第三方库(来自Infragistics的例如控制。)

First of all, I can't move the yellow arrow in Visual Studio 2010 to step into other lines of code, and also I am getiing exceptions ("Cannot find the method on the object instance.") when trying to do a quick watch on objects from a third party library (controls from Infragistics for example.)

Dim data = My.Computer.FileSystem.ReadAllBytes(file.FullName)
Assembly.Load(data)

在使用的Assembly.Load(字符串) ,一切正常,并没有任何问题。

When using Assembly.Load(String), everything works fine, and there are no problems.

Assembly.Load(IO.Path.GetFileNameWithoutExtension(file.Name))

任何想法,为什么的行为是多大的不同?无论如何,以解决这一问题?

Any idea why the behaviour is that much different? Anyway to fix this?

我尝试加载调试符号为我组装的Assembly.Load(byte []的。字节[]),而是试图从第三方库中的调试对象时,我仍然可以例外。

I tried loading the debugging symbols for my assembly with Assembly.Load(byte[]. byte[]), but I still get exceptions when trying to debug objects from third party libraries.

推荐答案

为您装配调试符号没有被加载到应用程序域。当您使用字符串品种,.NET自动查找.PDB沿着您指定的文件名。

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.

要加载程序集的的从字节数组的符号,使用 的Assembly.Load(byte []的,字节[]) ,像这样:

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)

这篇关于调试动态加载的程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆