-
-
Notifications
You must be signed in to change notification settings - Fork 812
Misleading exception when type parameter of mocked class is internal #192
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
Comments
With the current version of Moq, the exception messages in your tests come directly from DynamicProxy, not from Moq. The exception message for the
The exception message for the
So what you're asking for has already been fixed in DynamicProxy. |
@stakx nigga! u have a record on closing issue. you should wait for responses first. |
@RipPer56:
Yes, for the simple reason that I have been the most active collaborator here during the last year or so. Closing issues isn't a bad thing. It doesn't by itself imply any kind of disagreement with the issue, nor that the OP should shut up, nor any other form of hostility. It simply means that nothing more can be done at the moment. It also isn't necessarily a permanent act: People can still comment, and if it turns out that we're not done yet, issues can be reopened. On the whole, closing issues makes it easier for us to know what's currently happening, and what we need to deal with that people are still actively interested in. Regarding the present issue, what purpose would've been served by keeping it open for longer when it has demonstrably become obsolete in the meantime?
Regarding the present issue, exactly what kind of response should I have waited for? If you feel that you can do a better job, why not prove it by hopping on board and get to work? There are many open source projects, Moq included, that would love to have more active collaborators! Let us know if you're interested, e.g. over in Moq's Gitter chat! 🎆 |
I've seen you everywhere responding to issues and i respect that. But don't be such a crybaby about a small remarque. Closing issue is a big deal because other collaborators and members filter only open issues. And in many cases, especially in roslyn repository, people are closing issues that are really helpful for the community! So for me i think closing an issue should be the responsability of its creator or in the case that he forgets about it ☺ |
For
new Mock<MockedClass>()
, MockedClass needs to be accessible to DynamicProxy. If it isn't, Moq produces a helpful exception message.When mocking a generic class, say
new Mock<Container<Whatever>>
, both Container and Whatever need to be accessible to DynamicProxy. However, if the second type parameter ("Whatever") is not accessible, the exception message is very much misleading - it saysI lost an hour isolating the real reason for this exception. Please change Moq to return an exception message similar to the first case, mentioning the correct type ("Whatever").
The following NUnit test class demonstrates the issue (provided the
InternalsVisibleTo
attribute was not set on the assembly):The text was updated successfully, but these errors were encountered: