You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upon trying to mock an internal interface in another assembly, an exception is thrown with the message
Type UtilLib.ICollaborator is not visible to DynamicProxy. Can not create proxy for types that are not accessible. Make the type public, or internal and mark your assembly with [assembly: InternalsVisibleTo(InternalsVisible.ToDynamicProxyGenAssembly2)] attribute.
The message is for a hypothetical UtilLib.ICollaborator interface, but it hold true for any interface. The last part of the message [assembly: InternalsVisibleTo(InternalsVisible.ToDynamicProxyGenAssembly2)] is a little misleading, as the required assembly DynamicProxyGenAssembly2 is wrongfully stated as InternalsVisible.ToDynamicProxyGenAssembly2.
It turns out the message(and the exception owning it) doesn't originate from moq, but from Castle.Core assembly which is a dependency of moq. Currently moq specifies Castle.Core 3.2.0 as a dependency. I checked Castle.Core latest version 3.3.3 and found that it fixed the message.
Please consider upgrading to Castle.Core 3.3.3 for a clearer and correct exception message; I'm going to create a PR shortly for that.
The text was updated successfully, but these errors were encountered:
Upon trying to mock an internal interface in another assembly, an exception is thrown with the message
The message is for a hypothetical UtilLib.ICollaborator interface, but it hold true for any interface. The last part of the message
[assembly: InternalsVisibleTo(InternalsVisible.ToDynamicProxyGenAssembly2)]
is a little misleading, as the required assemblyDynamicProxyGenAssembly2
is wrongfully stated asInternalsVisible.ToDynamicProxyGenAssembly2
.It turns out the message(and the exception owning it) doesn't originate from moq, but from Castle.Core assembly which is a dependency of moq. Currently moq specifies Castle.Core 3.2.0 as a dependency. I checked Castle.Core latest version 3.3.3 and found that it fixed the message.
Please consider upgrading to Castle.Core 3.3.3 for a clearer and correct exception message; I'm going to create a PR shortly for that.
The text was updated successfully, but these errors were encountered: