Open GoogleCodeExporter opened 9 years ago
The exception thrown, btw, is:
Test method MVC.Tests.UnitTest1.TestMethod1 threw exception:
System.MissingMethodException: Method not found:
'Moq.Language.Flow.ICallbackResult
Moq.Language.ICallback.Callback(System.Action`5<!!0,!!1,!!2,!!3,!!4>)'.
Original comment by joejunio...@gmail.com
on 22 Apr 2013 at 11:27
Actually this may be less of an issue with MoQ than with a combination of MoQ
and AutoFixture and use of the gac with multiple versions of Moq installed.
Note that AutoFixture has an AutoMoqCustomization() that is useful to many
developers for reducing test-size dramatically (they are nice complements of
each other).
I believe the latest version of AutoFixture (as of the time of this writing) is
compiled directly against 3.1.416.3. That requires an assembly binding
redirect to be setup in the MSTest project's app.config file in order to get
AutoFixture to work properly:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- http://stackoverflow.com/questions/6505591/autofixture-and-moq-v4 -->
<dependentAssembly>
<assemblyIdentity name="Moq"
publicKeyToken="69f491c39445e920"
culture="neutral"/>
<bindingRedirect oldVersion="3.1.416.3"
newVersion="4.0.10827.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
When I remove that bindingRedirect, the issue resolves itself, however
AutoFixture breaks.
When I put that binding back, I can get both AutoFixture and Moq to work if I
UNGAC the 3.1 version of MoQ. I can then either reference the 4.0 via
GAC/strongname or not, and both will play well together.
Perhaps the assembly binding redirect is somehow detecting the 3.1 version of
MoQ in the gac and overwriting the 4.0 version with it, causing weird issues
like the one reported here.
See this URL for more issues:
http://stackoverflow.com/questions/6505591/autofixture-and-moq-v4
This bug can probably be closed.
Original comment by joejunio...@gmail.com
on 23 Apr 2013 at 12:09
Original issue reported on code.google.com by
joejunio...@gmail.com
on 22 Apr 2013 at 11:19