-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
Setup cannot invoke callback with different number of parameters in Moq 4.8.1 #572
Comments
@Caraul, thanks for reporting. Without looking into this in detail, this looks like a regression introduced in 4.8.0. This used to work in Moq 4.7.145, but I'm not sure whether that was by design or incidental. Will try to look into this in the next few days. |
It's indeed a regression caused by #520 / commit 104c646 (which aimed to make delegate validation more strict, as you've already found out). We didn't have a test for the extension method case you've provided. I'll add a regression test for this to the test suite, and fix the problem sometime in the next few days... or would you prefer to submit a PR yourself? |
Well, fix won't take weeks but one week maybe cause I need to go deeper inside Moq - if next week ASAP is acceptable then I'm in with PR. |
@Caraul, that is fine. 👍 I expect that a local fix in just that validation method should be possible; check whether the callback is an extension method ( Please don't forget to also add one or more unit tests to the test suite. :) Thank you! |
Issue #572 Setup cannot invoke callback with different number of parameters in Moq 4.8.1
Thanks for moving Moq forward - Good job! 👍 |
Great news, thank you very much! |
Hi,
looks like adding ValidateReturnDelegate makes extension methods unusable in zero argument methods such as property getters. Here is small repro that fails at Setup phase with ArgumentException:
Not sure if this is expected effect - please could anyone tell is such behavior correct?
The text was updated successfully, but these errors were encountered: