Open
Description
Issue Summary
After migrating a .NET Framework console application to the dotnet
SDK format, we are facing runtime assembly load problems for FSharp.Core
.
To Reproduce
Create a console app in the SDK project format, and restrict the FSharp.Core
version to 7.0.0
via a <PackageReference Update="FSharp.Core" version="7.0.0" />
Run any query generated by the library that returns data with a property having value of type 'a option
.
Error
An exception with this in the stack trace:
...snipped...
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'FSharp.Core, Version=8.0.0.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)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
at System.Type.GetType(String typeName, Boolean throwOnError)
at FSharp.Data.SqlClient.Internals.ISqlCommand Implementation..ctor(DesignTimeConfig cfg, FSharpChoice`3 connection, Int32 commandTimeout)
...snipped...
The version of FSharp.Core
in the compiled output is "7.0.0.", and if we add the following assembly binding redirect in app.config
, the problem disappears:
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
Expected behavior
The library should use the same version of FSharp.Core
as the project it is used by.
What you can do
- [] I am willing to contribute a PR with a unit test showcasing the issue
- I am willing to test the bug fix before next release
Metadata
Metadata
Assignees
Labels
No labels