0

I'm getting an error when running this F# Script in the Xamarin Studio (Mac OS X) F# Interactive window:

#r @"../../packages/RabbitMQ.Client/lib/net45/RabbitMQ.Client.dll"
#r @"../../packages/EasyNetQ/lib/net45/EasyNetQ.dll"

open System
open RabbitMQ.Client
open EasyNetQ

let ServiceBusHost = "host=myRabbitMQServer;virtualHost=someHost;username=someUser;password=somePwd;timeout=0"

let serviceBus = RabbitHutch.CreateBus(ServiceBusHost)

Error:

"Could not resolve field token 0x0400000b" <null>
System.BadImageFormatException: Could not resolve field token 0x0400000b
File name: 'EasyNetQ'
at <StartupCode$FSI_0004>.$FSI_0004.main@ () <0x790eb10 + 0x00153> in <filename unknown>:0 
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x1a55ba0 + 0x000a1> in <filename unknown>:0 
Stopped due to error

But it runs ok in Visual Studio 2015 (Windows). I have the packages installed and properly referenced, also the ServiceBusHost is working fine in the VS 2015 (Windows).

Target Framework: Mono / .NET 4.5 Compiler Configuration: Debug / Any CPU OS: Mac OS X

Any ideas?

Márcio Azevedo
  • 123
  • 1
  • 4
  • 8
  • A bit of a shot in the dark because I'm on not Mac: `BadImageFormatException` is something I've seen frequently when there is a mismatch between 32/64 bit - for example, when the VS debugger host process is running in 32bit mode, but I'm trying to load a 64bit native DLL. The error message you see here also hints at one of the DLLs loading something native. Could it be that your FSI instance is running 32bit? – Anton Schwaighofer Apr 21 '16 at 08:40
  • I've just tested it on Windows with the FSI (on Visual Studio) running both x86 and x64, and in both cases it worked well. Could it be any unsupported issue with Mono for the EasyNetQ or RabbitMQ.Client library? Because, on Mac OS X, I'm running Mono 4.4.0, unlike Windows which uses .NET 4.5 Framework. – Márcio Azevedo Apr 21 '16 at 10:37
  • What I meant was: does your FSI process on OS X have a notion of running in 32/64 bit? – Anton Schwaighofer Apr 21 '16 at 13:06
  • Yes, maybe it is a problem with the FSI, because Tamarin Studio is running in 32 bits. When I run this as a normal Console App the problem seems to be gone. – Márcio Azevedo Apr 28 '16 at 14:05

0 Answers0