-
-
Notifications
You must be signed in to change notification settings - Fork 802
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
Improve a exception message for extension methods. #1305
Comments
I agree that the suggested error message would be more helpful than the current one. Feel free to submit a PR. Extra points if the code generating the error message can be set up in such a way that we can easily extend it to also provide a descriptive error for other types of non-overridable methods (e.g. static or sealed methods). |
After trying to implement it, I have found the So Actual result I have mentioned in the issue should be like this:
I'm sorry for submitting the issue. |
I am glad you found this out. I vaguely remembered that we already have a more precise exception message re: extension methods somewhere but I didn't realise it would show up in your scenario. All good & no worries. |
Steps to reproduce
Trying to mockick
IMemoryCache
like this:Actual result:
Expected result:
The issue is that this extension method has same name and parameters set as the one from the interface and it's not clear what's wrong with Setup when just looking into the code.
The text was updated successfully, but these errors were encountered: