Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Castle.Core 3.3.3 to get correct exception messages #203

Closed
MSK61 opened this issue Sep 25, 2015 · 1 comment
Closed

Upgrade to Castle.Core 3.3.3 to get correct exception messages #203

MSK61 opened this issue Sep 25, 2015 · 1 comment

Comments

@MSK61
Copy link
Contributor

MSK61 commented Sep 25, 2015

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.

@MSK61
Copy link
Contributor Author

MSK61 commented Sep 25, 2015

Sorry, didn't know that pull requests create their own issues. You'll find my PR in another issue #204.

@kzu kzu closed this as completed in b2cf2d3 Sep 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant