MissingMethodException when using Unquote claims

I am trying to use unquote with NUnit as a test runner. The test case is taken from Getting Started and works as expected when launched outside of NUnit:

namespace FsTest.Tests open NUnit.Framework open Swensen.Unquote [<TestFixture>] module Example = [<Test>] let foo() = test <@ (1+2)/3 = 1 @> 

In NUnit, I get this exception:

FsTest.Tests.Example.foo: System.MissingMethodException: method not found: "System.Tuple 2<Microsoft.FSharp.Collections.FSharpList 1, Microsoft.FSharp.Quotations.FSharpExpr> Internal.reduceFullyAndGetLast (Microsoft.FSharp.Quprations. )

I would like to know if something is wrong with the code above and how I can make it work. Unquote raise doesn't work for me in the same way if that helps.

+5
source share
1 answer

Based on a description of your problem, I suspect that you need to configure your NUnit project with FSharp.Core binding FSharp.Core from version 4.0.0.0 to version 4.3.0.0, since the latest version of Unquote is built for .NET 4.0 and your test project targets .NET 4.5 .

See more details. I believe your configuration will look something like

 <?xml version="1.0" encoding="utf-8"?> <configuration> <runtime> <legacyUnhandledExceptionPolicy enabled="true" /> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="2.0.0.0" newVersion="4.3.0.0"/> <bindingRedirect oldVersion="4.0.0.0" newVersion="4.3.0.0"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> 

I'm not sure where exactly you will need to put this for the NUnit project, but maybe in the configuration file specified in the Project Editor ?

Unfortunately, I do not have VS2012, and therefore I am a little crippled in my ability to really diagnose this problem for you.

+8
source

All Articles