views:

54

answers:

2

Hello,

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

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

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.) (Exception from HRESULT: 0x80131019)

Note : TestManager.dll itself managed dll and loaded into another CLR process in CLI and trying to load EXE assembly as seperate process but fails and generates about exception.

This could probably be due to playing with mixed mode. I am stuck here and needs kind help.

Regards Usman

A: 

"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."

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).

Stephen Cleary
referenced EXE assembly is'nt native that is also written in managed mode C++/CLI and it also not refering anything at all from native world its completly managed EXE. But loader assembly which's a managed dll is mixed, it calls some native functions and loading this managed EXE . Here it generates exception.
Usman
Parse fail. Could you edit your question with a clear description of which assemblies are mixed and which managed? Naming them would help clarify.
Stephen Cleary
A: 

I think you need to use named pipes for inter process communication in .NET. Assembly.Load will not work for EXE assemblies.

Hassan