jgoz / netzmq

ZeroMQ bindings for .NET and Mono
Apache License 2.0
7 stars 3 forks source link

ZeroMQ.Proxy.dll not a valid Win32 application #3

Open BrandonPotter opened 12 years ago

BrandonPotter commented 12 years ago

Added NetZMQ via NuGet to an Any CPU project. On run, I get an exception on this line:

_publishContext = ZeroMQ.Sockets.ZmqContext.Create(1);

Could not load file or assembly 'ZeroMQ.Proxy.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

Looks like an awesome library so far, so trying to get this working.. :)

jgoz commented 12 years ago

Hmm, interesting.

Do you have the Visual C++ 2010 Redistributable Package installed? I haven't tested this on a machine without the C runtime yet, so that may be an issue.

Also, are you running 32 or 64-bit Windows?

Thanks for testing it out!

BrandonPotter commented 12 years ago

I am running 64-bit Windows 7 with the following installed (Dev workstation):

Visual C++ 2005 Redistributable Visual C++ 2008 Redistributable - x86 9.0.30729.4974 Visual C++ 2010 x64 Designtime - 10.0.30319 Visual C++ 2010 x64 Runtime - 10.0.30319 Visual C++ 2010 x86 Runtime - 10.0.30319

Exception occurred when running straight from Visual Studio 2010 in debug mode - haven't tested it any other way.

Let me know if you want additional info...

jgoz commented 12 years ago

Another question for you: do you have any other libzmq.dll files floating around, especially in your project Output dir or on the system path?

If there are other libzmq.dlls in the search path, netzmq will use those instead of its bundled versions. This was done for flexibility, but it might end up biting a lot of people. So in your case, if you have a 32-bit libzmq somewhere, netzmq might be trying to use that even though it is running in 64-bit mode, which would cause a BadImageFormatException.

Are there any inner exceptions bundled in the exception you're seeing?

BrandonPotter commented 12 years ago

I did remove all of the libzmq references, however it's entirely possible that I missed one. I'll double check this and give it a try as well as check for InnerExceptions.

Thanks!

jgoz commented 12 years ago

Brandon, were you able to get this working?

stemarie commented 10 years ago

On Windows 8 64 Bit, using VS2012 using 32bit clrzmq, tried 64bit and got the same problem

{"A procedure imported by 'ZeroMQ.Proxy.dll' could not be loaded.":"ZeroMQ.Proxy.dll"}

InnerException: null

A procedure imported by 'ZeroMQ.Proxy.dll' could not be loaded.

at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) at System.Reflection.Assembly.LoadFrom(String assemblyFile) at ZeroMQ.Proxy.ProxyAssemblyLoader.ExtractAndLoadFromPath(String dir) in c:\Users\Johnny\Documents\Projects\netzmq\src\proj\ZeroMQ\Proxy\ProxyAssemblyLoader.cs:line 62 at ZeroMQ.Proxy.ProxyAssemblyLoader.LoadFromExecutingPath() in c:\Users\Johnny\Documents\Projects\netzmq\src\proj\ZeroMQ\Proxy\ProxyAssemblyLoader.cs:line 35 at ZeroMQ.Proxy.ProxyAssemblyLoader.Load() in c:\Users\Johnny\Documents\Projects\netzmq\src\proj\ZeroMQ\Proxy\ProxyAssemblyLoader.cs:line 18 at ZeroMQ.Proxy.ProxyFactory.Create() in c:\Users\Johnny\Documents\Projects\netzmq\src\proj\ZeroMQ\Proxy\ProxyFactory.cs:line 27 at System.Lazy`1.CreateValue()