-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dotnet SDK projects using FSharp.Core version 7.0.0 breaks at runtime #433
Comments
@sgryt thanks for the report. From what I understand, it is more likely to be a dotnet/sdk issue or (maybe) dotnet/fsharp one, there is nothing in the I have had my own issues over the years of using dotnet framework, related to assembly bindings, and generally resort to using paket to handle the the consistency of those, but your mileage may vary. I'll keep the ticket open to track the progress on resolving it, but encourage you to gather a minimum reproduce project, and opening an issue on dotnet/sdk. Hope you'll be able to understand why this is occurring, and confirmation it reproduces (please provide a self contained zipped sample where it is minimum steps from command line to build, to make sure the sdk team can look into it). |
@smoothdeveloper: I'm not deeply familiar with type provider internals, but I The exception appears to be caused by a general limitation across type providers Code like
results in
with a stack trace of
The offending type provider code is at
Here De-sugaring the async computation expression above and reverse compiling the
Notice how part of the instantiation consists of
which is the return type from calling the type provider and the underlying Digging through
where I believe The underlying issue can be illustrated by creating a .NET console application
Then include the following code:
Not pinning As during compilation When the equivalent of
evaluates inside the compiler, the result is a "type string" containing Now, the compiler is aware of the
But this information may be lost/hard to get at inside the design-time of a type So either (1) upgrade the application to the latest version of F# installed, (2) |
I'm unlikely to "correct", but share my understanding (which can be misguided, as this is either a fsharp or TP SDK issue, not an dotnet/sdk one), and your analysis seems thorough (based on looking up IL types emitted by the compiler, and investigating the quotations in the type provider implementation). I believed the binding redirects were not needed anymore but in .NET framework, but it sounds I was too hopeful. The analysis you make about the TP in the compiler is correct, I'm not sure if the newer versions of the Type Provider SDK (we are on one of the early that supported .net core, sdk v2 era) help solving the issue, nor if the type provider implementation should define things for the TP SDK to do the relinking, I only know any time I tried to upgrade the TP SDK, it was a bit though, or I couldn't make it work (but also due to sdk v2 in the master branch and not enough know how). Let's keep the issue open (others will find useful information, and learn about binding redirect when they have same error), and when I'm able to update Type Provider SDK while keeping everything green on CI, we should give it another look, in case there is some form of detection between runtime references versus what the compiler binds against. Thanks @ronnieholm for giving a shot at reproducing @sgryt issue, and all the analysis. For now, I effectively can't solve those use cases, and only encourage people to closely care for their binding redirects, msbuild or paket can be used to deal with it in ways which aren't 100% manual. |
Issue Summary
After migrating a .NET Framework console application to the
dotnet
SDK format, we are facing runtime assembly load problems forFSharp.Core
.To Reproduce
Create a console app in the SDK project format, and restrict the
FSharp.Core
version to7.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:
The version of
FSharp.Core
in the compiled output is "7.0.0.", and if we add the following assembly binding redirect inapp.config
, the problem disappears:Expected behavior
The library should use the same version of
FSharp.Core
as the project it is used by.What you can do
The text was updated successfully, but these errors were encountered: