Moq4: Method not found: 'Void Castle.DynamicProxy.ProxyGenerationOptions.AddDelegateTypeMixin(System.Type)'..

Created on 7 Oct 2019  路  2Comments  路  Source: moq/moq4

System.MissingMethodException: Method not found: 'Void Castle.DynamicProxy.ProxyGenerationOptions.AddDelegateTypeMixin(System.Type)'.. Stacktrace at Moq.CastleProxyFactory.CreateProxy(Type mockType, IInterceptor interceptor, Type[] interfaces, Object[] arguments) at Moq.Mock`1.InitializeInstance() at Moq.Mock`1.OnGetObject() at Moq.Mock.get_Object() at Moq.Mock`1.get_Object() at Msei.Fsd.OpcUaFoundationDriver.TestDoubles.OpcSessionTestDouble.get_Object()

We are using:
Moq v.4.13.0,
Castle Core 4.4.0

What is interesting: it works in Visual Studio but fails in vstest.console.exe from command line

Most helpful comment

This is almost certainly a problem with your project setup / NuGet tooling. Make sure the right version of Castle.Core gets loaded. I'm going to close this since with 99.9% certainty, the problem doesn't reside with Moq, but with your own project. If you think that's in error, please post a repro project.

All 2 comments

This is almost certainly a problem with your project setup / NuGet tooling. Make sure the right version of Castle.Core gets loaded. I'm going to close this since with 99.9% certainty, the problem doesn't reside with Moq, but with your own project. If you think that's in error, please post a repro project.

Thank you for quick response.
You are right.
I just have found the issue: There were two test projects in solution. First one referencing older moq and, as result, older version of Castle.Core.DLL.
vstest.console.exe was executed for both projects. It looks like moq and Castle.Core.DLL have been loaded once. I have changed order of the projects referencing under vstest.console.exe and it started work. Microsoft vstest.console.exe does not check required versions of DLLs!

Was this page helpful?
0 / 5 - 0 ratings