mbraceproject / FsPickler

A fast multi-format message serializer for .NET
http://mbraceproject.github.io/FsPickler/
MIT License
324 stars 52 forks source link

System.MissingMethodException with XUnit #36

Closed jamesjrg closed 9 years ago

jamesjrg commented 9 years ago

I have the following code:

module flibble

open Xunit
open Nessos.FsPickler
open Nessos.FsPickler.Json

[<Fact>]
let ``Should blah``() =
    let jsonPickler = FsPickler.CreateJson()
    ()

When I run this test I get:

System.MissingMethodExceptionMethod not found: 'Nessos.FsPickler.Json.JsonSerializer Nessos.FsPickler.Json.FsPickler.CreateJson(Microsoft.FSharp.Core.FSharpOption`1<Boolean>, Microsoft.FSharp.Core.FSharpOption`1<Boolean>, Microsoft.FSharp.Core.FSharpOption`1<Nessos.FsPickler.ITypeNameConverter>)'.
   at flibble.Should blah()

I am using .NET Framework 4.5 and F# 3.1. I have tried both the console runner and the Resharper Visual Studio runner, both have the same effect.

Any ideas as to how I can fix this?

Thanks!

jamesjrg commented 9 years ago

I needed to include the following binding redirect:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
      </dependentAssembly>
    </assemblyBinding>
eiriktsarpalis commented 9 years ago

It looks like you are missing a binding redirect to FSharp.Core.