I try to mock an internal interface in Silverlight 4, using moq-silverlight 4.0.10827.0.
I get an error "Can not create proxy for types that are not accessible." in a Castle.DynamicProxy.Generators.GeneratorException.
I have [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] in the assemblyInfo of the tested assembly. I do not have any signed assemblies.
The
InternalsVisibleTo
switch works only in this scenario: You have to apply it in the assembly containing the internals you want to be visible to another assembly. If it would work when you specify it in an assembly who wants to consume those internals, then it would be a great security leak!