-
-
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
4.13 callback with returns and out parameter ~ bug? #917
Comments
Correct. See this entry in the changelog:
|
Reopening. If that's correct, I'd like to take a closer look. |
The code posted above fails in Moq 4.12.0. It succeeds only when The code posted above fails in Moq 4.13.0, regardless of whether |
Thanks for the clarification and the prompt reply. Can you tell me how to save my variables now? I can't use the out keyword on the callback to have my callback's parameter types to match those on the method, can I? |
delegate void JustAMethodCallback(string name, out string outParam);
...
_myMock.Setup(...).Callback(new JustAMethodCallback((string name, out string outParam) => ...); The custom delegate type is necessary because Moq only provides overloads for |
The following worked in 4.12:
But fails on 4.13 with this exception:
Looks like it has to do with this change.
Is this not a bug/breaking change?
Update: this also fails if you call 'Returns' first before 'Callback'.
The text was updated successfully, but these errors were encountered: