I have an exception from Rhino Mocks 3.6.0 and 3.6.1 when mocking the following interface:
public interface ic
{
IComponentConfig<TImpl> Bob<TSvc, TImpl>()
where TImpl : TSvc;
}
I can confirm that when removing the Generic "where" association, it will correctly mock.
The Stack trace points firmly at Castle Dynamic Proxy:
System.BadImageFormatException was unhandled by user code HResult=-2147024885 Message=An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Source=mscorlib StackTrace: at System.Reflection.Emit.TypeBuilder.TermCreateClass(RuntimeModule module, Int32 tk, ObjectHandleOnStack type) at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock() at System.Reflection.Emit.TypeBuilder.CreateType() at Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType() at Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType() at Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.GenerateCode(Type proxyTargetType, Type[] interfaces, ProxyGenerationOptions options) at Castle.DynamicProxy.DefaultProxyBuilder.CreateInterfaceProxyTypeWithoutTarget(Type interfaceToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options) at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyTypeWithoutTarget(Type interfaceToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options) at Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type interfaceToProxy, Type[] additionalInterfacesToProxy, ProxyGenerationOptions options, IInterceptor[] interceptors) at Rhino.Mocks.MockRepository.MockInterface(CreateMockState mockStateFactory, Type type, Type[] extras) at Rhino.Mocks.MockRepository.CreateMockObject(Type type, CreateMockState factory, Type[] extras, Object[] argumentsForConstructor) at Rhino.Mocks.MockRepository.DynamicMock[T](Object[] argumentsForConstructor) at Rhino.Mocks.MockRepository.<>c__DisplayClass7
1.<GenerateMock>b__6(MockRepository r) at Rhino.Mocks.MockRepository.CreateMockInReplay[T](Func
2 createMock) at Rhino.Mocks.MockRepository.GenerateMock[T](Object[] argumentsForConstructor) at XXXXX.ConfigTestBase.SetUp() in c:\git\MyFork\Workspace\Db.Montage.Common.Tests\Config\ConfigTestBase.cs:line 27 InnerException: