3

I'm trying to write a unit test project using FSUnit.xUnit.

Throughout my development on this process, I have been plagued by tests failing with this message (not always citing the same version):

Could not load file or assembly 'FSharp.Core, Version=3.259.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Adding binding redirects seems to have no effect. My latest one is:

  <configuration>
    <runtime>
      <dependentAssembly>
        <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0" />
      </dependentAssembly>
    </runtime>
    <startup>
      <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
    </startup>
  </configuration>

The only thing that has worked up until now is downgrading the FSharp.Core NuGet package, but in this latest incarnation even this has failed.

I am losing a lot of time over this issue. Any help will be very gratefully received.

UPDATE

From what I can make out, this is due to a bug in Json.NET. The tests are running, but the error is being thrown within the assembly while I am serialising and deserialising discriminated unions. I have submitted an issue in Json.NET.

FURTHER UPDATE

I am calling the Json.NET serialiser from a test project targeting F# Version 4.4.0.0, and the object I'm trying to serialise is defined in a portable assembly with Profile259 (portable-net45+netcore45+wpa81+wp8). The portable assembly contains the same binding redirects.

Rob Lyndon
  • 12,089
  • 5
  • 49
  • 74

0 Answers0