I did just that this morning, and I'll be, that fixed the problem. I
don't know what's different about the 3.6 version posted on the
official site
http://ayende.com/projects/rhino-mocks/downloads.aspx

I typically don't build such libraries from source, but I guess in
this case I'll have to make an exception. I was getting all set to
refactor my interfaces to split out the where generic type constraint
into a separate interface, since I'm pretty sure that's what was
triggering the issue. Thanks for your suggestion, Tim.

On Jul 16, 5:05 pm, Tim Barcz <[email protected]> wrote:
> can you build from Rhino trunk and let me know if that fixes the
> problem....or if it persists.
>
> On Fri, Jul 16, 2010 at 4:02 PM, SilverSideDown <[email protected]>wrote:
>
>
>
>
>
> > I'm running 3.6 and I still get the error :-(
>
> > On Jul 4, 11:26 am, Kenneth Xu <[email protected]> wrote:
> > > Did you try Rhino.Mocks 3.6?
>
> > > On Fri, Jul 2, 2010 at 9:13 AM, Patrick Steele <[email protected]
> > >wrote:
>
> > > > Sounds like you're running into this issue:
>
> > > >http://groups.google.com/group/rhinomocks/browse_thread/thread/2c1b53.
> > ..
>
> > > > The recommended fix (according to the thread) is to build your own
> > > > copy of Rhino.Mocks with the latest DynamicProxy (which has this bug
> > > > fixed).
>
> > > > ---
> > > > Patrick Steele
> > > >http://weblogs.asp.net/psteele
>
> > > > On Wed, Jun 23, 2010 at 8:05 AM, Jens Melgaard <[email protected]>
> > wrote:
> > > > > Hello there, we have an issue Mocking out a few of our interfaces,
> > for
> > > > > now it ain't a huge problem for us since we have a workaround that is
> > > > > tolerable for the moment.
>
> > > > > Here is the Full StackTrace:
>
> > > > > 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
>
> > Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType()
> > > > > at
>
> > Castle.DynamicProxy.Generators.Emitters.AbstractTypeEmitter.BuildType()
> > > > > at
>
> > Castle.DynamicProxy.Generators.InterfaceProxyWithTargetGenerator.GenerateCo
> > de(Type
> > > > > proxyTargetType, Type[] interfaces, ProxyGenerationOptions options)
> > > > > at
>
> > Castle.DynamicProxy.DefaultProxyBuilder.CreateInterfaceProxyTypeWithoutTarg
> > et(Type
> > > > > theInterface, Type[] interfaces, ProxyGenerationOptions options)
> > > > > at
>
> > Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyTypeWithoutTarget(Ty
> > pe
> > > > > theInterface, Type[] interfaces, ProxyGenerationOptions options)
> > > > > at
>
> > Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type
> > > > > theInterface, Type[] interfaces, ProxyGenerationOptions options,
> > > > > IInterceptor[] interceptors)
> > > > > at
>
> > Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type
> > > > > theInterface, Type[] interfaces, 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.GenerateMock<T>(Object[]
> > > > > argumentsForConstructor)
> > > > > at
>
> > Systematic.OMSIS.Runtime.Presentation.Services.Test.TransactionServiceAgent
> > Test.SetUp()
> > > > > in TransactionServiceAgentTest.cs: line 23
>
> > > > > The problem is rather simple to "solve" for us since we "own" the
> > > > > interface.
> > > > > Here is the interface:
>
> > > > >    public interface IServiceClientFactory
> > > > >    {
> > > > >        TService Create<TService, TClient>() where TClient:TService;
> > > > >    }
>
> > > > > If we make the following very small change to the interface, the
> > error
> > > > > disappears.
>
> > > > >    public interface IServiceClientFactory
> > > > >    {
> > > > >        TService Create<TService, TClient>();
> > > > >    }
>
> > > > > As might be noted, it is the the constraints on the Type Parameters
> > > > > that is gone.
> > > > > And now it works!...
>
> > > > > We are a bit unsure if it is Rhino.Mocks or Castle.DynamicProxy that
> > > > > contains the actual problem, since Castle may have extra demands on
> > > > > generating a proxy in the specific context above... or it may be
> > > > > castle that just has the issue...
>
> > > > > Anyways since we found a rather specific little detail we thought it
> > > > > could help to post it here, you can figure out if it should be
> > > > > forwarded i hope...
>
> > > > > Kind Regards
> > > > > Jens Melgaard
> > > > > Systematic
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Rhino.Mocks" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<rhinomocks%2bunsubscr...@googlegrou
> > > >  ps.com>
> > <rhinomocks%2bunsubscr...@googlegrou ps.com>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/rhinomocks?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Rhino.Mocks" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<rhinomocks%2bunsubscr...@googlegrou 
> > ps.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/rhinomocks?hl=en.
>
> --
> Tim Barcz
> Microsoft C# MVP
> Microsoft ASPInsiderhttp://timbarcz.devlicio.ushttp://www.twitter.com/timbarcz

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en.

Reply via email to