可调试不适用于通过反射加载的程序集

编程入门 行业动态 更新时间:2024-10-28 03:31:18
本文介绍了可调试不适用于通过反射加载的程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个相当复杂的场景.假设我们有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.

最好的问候

更多推荐

可调试不适用于通过反射加载的程序集

本文发布于:2023-11-13 09:37:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584023.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:反射   不适用于   加载   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!