Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't bindingRedirect affect FSharp.Core version

I have a unit test project that targets F# runtime 4.4.1. It has an app.config with the bindingRedirect section:

  <dependentAssembly>
    <Paket>True</Paket>
    <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="4.4.1.0" />
  </dependentAssembly>

However, when I run tests I get a runtime error:

Could not load file or assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

I wonder why there is an attempt to load FSharp.Core 4.3.0.0 since bindingRedirect specifies a different version.

like image 280
Vagif Abilov Avatar asked May 04 '26 16:05

Vagif Abilov


1 Answers

Apparently this is a problem with XUnit configutaration. The following section in app.config changed AppDomain configuration:

  <appSettings>
    <add key="xunit.appDomain" value="required" />
  </appSettings>

Then the test runner complained about missing xunit.execution.desktop.dll. Once the file was placed in the execution directory, XUnit runner honored app.config with bindingRedirect settings.

like image 178
Vagif Abilov Avatar answered May 09 '26 07:05

Vagif Abilov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!