tags:

views:

49

answers:

1

I want to host NServiceBus inside my own process.

I was getting a null reference exception when configuring NServiceBus, I changed the order of some of the configure calls which seemed to resolve that. I am now faced with another error. This is the configuration code I have:

Configure.With()
                .CastleWindsorBuilder(Container.Instance)
                .XmlSerializer()
                .MsmqSubscriptionStorage()
                .MsmqTransport()
                .UnicastBus()
                .LoadMessageHandlers()
                .CreateBus()
                .Start();

Here is the stack trace:

Exception

Castle.MicroKernel.ComponentActivator.ComponentActivatorException

Error setting property set_MessageTypes on type NServiceBus.Serializers.XML.MessageSerializer, Component id is NServiceBus.Serializers.XML.MessageSerializer. See inner exception for more information.

Inner Exception Detail:

System.BadImageFormatException

"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

   at System.Reflection.Emit.TypeBuilder._TermCreateClass(Int32 handle, Module module)
   at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
   at System.Reflection.Emit.TypeBuilder.CreateType()
   at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.CreateTypeFrom(Type t, ModuleBuilder moduleBuilder)
   at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.InitType(Type t, ModuleBuilder moduleBuilder)
   at NServiceBus.MessageInterfaces.MessageMapper.Reflection.MessageMapper.Initialize(IEnumerable`1 types)
   at NServiceBus.Serializers.XML.MessageSerializer.set_MessageTypes(List`1 value)
A: 

It could be that in one of the assemblies deployed to your runtime directory you have message types which reference some other type which could not be loaded as it was compiled on the wrong platform.

Udi Dahan