Problem using MarshalByRefObject and [Dependency]

Mar 5, 2007 at 9:29 AM

I'm using OB to make a "composite server" where each module runs in its own AppDomain. When a module needs a ref to another module it can e.g write a constructor like

ModuleA(DependencyIModuleB moduleB)

However, this fails at runtime because the Guard.ValidateMethodParameters call in CreationStrategy.InitializeObject fails because it cannot validate that IModuleB can be assigned from a MarshalByRefObject (which ModuleB class is since it runs in another AppDomain).

Is this by design?

The only solution I can think of is to replace the default CreationStrategy with my own copy where the type check is left out. Is there a better way?

Thanks in advance