You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stumbled upon the following while implementing #105.
The following test sets up a Callback for a method having a ref parameter. Inside that callback, it tries to modify a captured variable (named capturedVariable). It turns out that the modification only succeeds if the captured variable isn't the one passed by-ref to the mocked method:
I am not sure yet whether this qualifies as a bug, but at the very least this behaviour is somewhat unintuitive and puzzling from a user's perspective.
The text was updated successfully, but these errors were encountered:
Yes, this probably classifies as a bug. Plain C# has no problem changing a captured variable if that variable is also passed to a method by-ref, so people will likely expect this to work in Moq, too:
We've decided over at castleproject/Core#316 that it's probably not a good idea for DynamicProxy to support this particular scenario, so Moq likewise won't allow it.
Stumbled upon the following while implementing #105.
The following test sets up a
Callback
for a method having aref
parameter. Inside that callback, it tries to modify a captured variable (namedcapturedVariable
). It turns out that the modification only succeeds if the captured variable isn't the one passed by-ref to the mocked method:I am not sure yet whether this qualifies as a bug, but at the very least this behaviour is somewhat unintuitive and puzzling from a user's perspective.
The text was updated successfully, but these errors were encountered: