Check with Dynamic Proxy v2.2 if the issue occurs.

Krzysztof


On 2010-04-19 18:57, Patrik Hägne wrote:
I'm in the process of putting out a signed version of FakeItEasy
(http://code.google.com/p/fakeiteasy/) that is using DynamicProxy2.
When doing this some of my integration tests fails with an exception
message similar to the one below. Also when deploying the new, signed
verision in a large application with thousands of tests that uses
FakeItEasy something like 30% of the tests fails with a similar
exception. I have the InternalsVisibleTo-attribute for DynamicProxy2
set on all FakeItEasy-assemblies like this:

[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2,
PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]

The exception:

System.TypeLoadException : Type
'ITypeWithFakeablePropertiesProxy3d17a4446fea440f9c91aec9693fd7d7'
from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null' is attempting to implement an
inaccessible interface.
        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.InterfaceProxyWithTargetGenerator.GenerateCode(Type
proxyTargetType, Type[] interfaces, ProxyGenerationOptions options)
        at
Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type
interfaceToProxy, Type[] additionalInterfacesToProxy,
ProxyGenerationOptions options, IInterceptor[] interceptors)
        at
Castle.DynamicProxy.ProxyGenerator.CreateInterfaceProxyWithoutTarget(Type
interfaceToProxy, Type[] additionalInterfacesToProxy, IInterceptor[]
interceptors)
        C:\Users\Patrik\Documents\Code\FakeItEasy\FakeItEasy - Strong Name
\Source\FakeItEasy\DynamicProxy\DynamicProxyProxyGenerator.cs(85,0):
at
FakeItEasy.DynamicProxy.DynamicProxyProxyGenerator.CreateInterfaceProxy(Type
typeToProxy, IEnumerable`1 additionalInterfacesToImplement,
FakeObjectInterceptor fakeObjectInterceptor)
        C:\Users\Patrik\Documents\Code\FakeItEasy\FakeItEasy - Strong Name
\Source\FakeItEasy\DynamicProxy\DynamicProxyProxyGenerator.cs(145,0):
at
FakeItEasy.DynamicProxy.DynamicProxyProxyGenerator.DoGenerateProxy(Type
typeToProxy, IEnumerable`1 additionalInterfacesToImplement, FakeObject
fakeObject, IEnumerable`1 argumentsForConstructor)
        C:\Users\Patrik\Documents\Code\FakeItEasy\FakeItEasy - Strong Name
\Source\FakeItEasy\DynamicProxy\DynamicProxyProxyGenerator.cs(50,0):
at
FakeItEasy.DynamicProxy.DynamicProxyProxyGenerator.GenerateProxy(Type
typeToProxy, IEnumerable`1 additionalInterfacesToImplement, FakeObject
fakeObject, IEnumerable`1 argumentsForConstructor)
        C:\Users\Patrik\Documents\Code\FakeItEasy\FakeItEasy - Strong Name
\Source\FakeItEasy\Core\Creation\DefaultFakeAndDummyManager.cs(119,0):
at
FakeItEasy.Core.Creation.DefaultFakeAndDummyManager.CreateProxy(Type
typeOfProxy, IEnumerable`1 additionalInterfacesToImplement,
IEnumerable`1 argumentsForConstructor, Boolean throwOnFailure)
        C:\Users\Patrik\Documents\Code\FakeItEasy\FakeItEasy - Strong Name
\Source\FakeItEasy\Core\Creation\DefaultFakeAndDummyManager.cs(63,0):
at FakeItEasy.Core.Creation.DefaultFakeAndDummyManager.CreateFake(Type
typeOfFake, FakeOptions options)
        C:\Users\Patrik\Documents\Code\FakeItEasy\FakeItEasy - Strong Name
\Source\FakeItEasy\Core\Creation\DefaultFakeCreator.cs(39,0): at
FakeItEasy.Core.Creation.DefaultFakeCreator.CreateFake[T](Action`1
options)
        C:\Users\Patrik\Documents\Code\FakeItEasy\FakeItEasy - Strong Name
\Source\FakeItEasy\A.cs(40,0): at FakeItEasy.A.Fake[T]()
        C:\Users\Patrik\Documents\Code\FakeItEasy\FakeItEasy - Strong Name
\Source\FakeItEasy.IntegrationTests\GeneralTests.cs(22,0): at
FakeItEasy.IntegrationTests.GeneralTests.Faked_object_with_fakeable_properties_should_have_fake_as_default_value()

I spoke to Krzysztof via e-mail and he suggested that I should update
to the latest version (2.2) and I've just tried that but I get the
same error.

Any ideas? I could provide you with the full source if you'd like for
debugging.

Cheers,
Patrik


--
You received this message because you are subscribed to the Google Groups "Castle 
Project Users" 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/castle-project-users?hl=en.

Reply via email to