在C ++/CLI中动态加载EXE程序集时发生异常(无法加载文件或程序集',版本= 1.0.3836.39802 ...) [英] Exception occured While loading dynamically EXE assembly in C++/CLI (Could not load file or assembly ', Version=1.0.3836.39802 ...)

查看:285
本文介绍了在C ++/CLI中动态加载EXE程序集时发生异常(无法加载文件或程序集',版本= 1.0.3836.39802 ...)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在动态加载程序集时遇到了C ++/CLI中的异常,该程序集本身使用Assembly.Load在C ++/CLI托管模式下创建了一个EXE.它可以成功加载DLL程序集,但无法加载EXE程序集并生成以下异常:

I am facing an exception in C++/CLI while dynamically loading assembly which itself creates an EXE in C++/CLI managed mode using Assembly.Load. It successfully loads a DLL assembly, but fails to load EXE assembly and generates the following exception:

TestManager.dll中发生了'System.IO.FileLoadException'类型的未处理异常

An unhandled exception of type 'System.IO.FileLoadException' occurred in TestManager.dll

无法加载文件或程序集'testAssembly,Version = 1.0.3836.39802,Culture = neutral,PublicKeyToken = null'或其依赖项之一.尝试使用修复程序(IAT包含两个以上的部分或一个TLS部分)加载无法验证的可执行文件.

Could not load file or assembly 'testAssembly, Version=1.0.3836.39802, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Attempt to load an unverifiable executable with fixups` (IAT with more than 2 sections or a TLS section.)

HRESULT的异常:0x80131019

Exception from HRESULT: 0x80131019

TestManager.dll本身是一个托管dll,并已加载到CLI中的另一个CLR进程中,并尝试将EXE程序集作为单独的进程加载,但失败并生成异常.

TestManager.dll itself is a managed dll and loaded into another CLR process in CLI and tries to load EXE assembly as a seperate process, but fails and generates an exception.

这可能是由于使用混合模式所致.

This could probably be due to playing with mixed modes.

推荐答案

混合模式C ++ EXE作为参考程序集加载时无法在内存中正确地重定位.这就是运行时失败的原因."

"A mixed mode C++ EXE cannot be relocated in memory properly when loaded as a referenced assembly. This is why there is a runtime failure."

引号来自 Microsoft对该错误在Connect上,他们在其中解释说他们将不进行修复(在极少数情况下会带来太多麻烦).

The quote is from Microsoft's response to this bug on Connect, where they explain that they're not going to fix it (too much trouble for a rare situation).

这篇关于在C ++/CLI中动态加载EXE程序集时发生异常(无法加载文件或程序集',版本= 1.0.3836.39802 ...)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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