可调试不适用于通过反射加载的程序集 [英] Debuggable does not work for assemblies loaded via reflection

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

问题描述

我有一个相当复杂的场景.假设我们有3个程序集:a.exe,b.dll和c.dll. b.dll引用c.dll.我启动a.exe,它会执行以下操作:

I have a rather complicated scneario. Let's say we have 3 assemblies: a.exe, b.dll and c.dll. b.dll references c.dll. I start a.exe, it does the following:

1.通过反射(Assembly.LoadFrom("b.dll"))加载b.dll

1. Loads b.dll via reflection (Assembly.LoadFrom ("b.dll"))

2.暂停并等待用户附加调试器.

2. Pauses and waits for the user to attach a debugger.

现在,我将VS附加到a.exe上,然后检查加载的模块.我可以看到b.dll并不是经过优化的,但是c.dll是经过优化的,尽管两者都是使用/optimize-选项构建的.我还通过IL Spy验证了c.dll确实已使用Debuggable属性进行了标记.如果我创建 一个d.exe并直接引用c.dll并在VS中调试d.exe,则c.dll尚未优化.因此,我很确定是c.dll的加载方式使其无法调试.

Now I attach VS on a.exe and I examine loaded modules. I can see that b.dll is not optimized but c.dll is, although both are built with /optimize- option. I have also verified with IL Spy that c.dll is indeed tagged with Debuggable attribute. If I create a d.exe and reference c.dll directly and debug d.exe in VS, c.dll is not optimized. So I'm pretty sure it's how c.dll is loaded that makes it not debuggable.

有什么想法为什么会这样?假设不能直接从VS启动a.exe.谢谢.

Any ideas why this is happening? Let's assume launching a.exe from VS directly is not an option. Thanks.

推荐答案

德灵,

欢迎来到MSDN论坛.

Welcome to the MSDN Forum.

我正在尝试在此线程中加入其他线程,请耐心等待.

I am trying to involve some other one in this thread, please wait it patiently.

最好的问候


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

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