FS#60718 - [dotnet-host] Cannot build when referencing 'FSharp.Data'

Attached to Project: Community Packages
Opened by Sebastian Schloßer (Sebastian256) - Tuesday, 06 November 2018, 18:42 GMT
Last edited by Maxime Gauduin (Alucryd) - Monday, 03 February 2020, 17:12 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Maxime Gauduin (Alucryd)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

I tried to build a small F# project that makes use of FSharp.Data.
dotnet build fails with the following error:

```
error FS3031 : The type provider '~/.nuget/packages/fsharp.data/3.0.0/lib/netstandard2.0/FSharp.Data.dll' reported an error : Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FSharp.Data.DesignTime' which cannot be loaded or doesn't exist. Could not load file or assembly 'FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. [/path/to/foo.fsproj]
FSC : warning FS3005: Referenced assembly '~/.nuget/packages/fsharp.data/3.0.0/lib/netstandard2.0/FSharp.Data.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found [/path/to/foo.fsproj]

The build failed. Please fix the build errors and run again.
```

However, the same project compiles fine on other Linux distributions and using the official fsharp:dotnet docker container.

Digging around I found a bug on GitHub (reported by another Arch user) containing minimal steps to reproduce the problem: https://github.com/dotnet/netcorecli-fsc/issues/123
This task depends upon

Closed by  Maxime Gauduin (Alucryd)
Monday, 03 February 2020, 17:12 GMT
Reason for closing:  Fixed
Additional comments about closing:  3.1.0.sdk100-2
Comment by Andre Soares (mniak) - Wednesday, 07 November 2018, 11:05 GMT
I have the same issue

STEPS TO REPRODUCE:
--------------------------------------------
dotnet new console -lang F#
dotnet add package FSharp.Data -v 3.0.0
dotnet build
--------------------------------------------

ERROR:
--------------------------------------------
error FS3031 : The type provider '/home/andre/.nuget/packages/fsharp.data/3.0.0/lib/netstandard2.0/FSharp.Data.dll' reported an error : Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FSharp.Data.DesignTime' which cannot be loaded or doesn't exist. Could not load file or assembly 'FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. [/home/andre/Documents/Projects/MyProject/MyProject.fsproj]
FSC : warning FS3005: Referenced assembly '/home/andre/.nuget/packages/fsharp.data/3.0.0/lib/netstandard2.0/FSharp.Data.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found [/home/andre/Documents/Projects/MyProject/MyProject.fsproj]
--------------------------------------------

ENVIRONMENT:
--------------------------------------------
$ uname -a
Linux AndreBook 4.18.9-arch1-1-ARCH #1 SMP PREEMPT Wed Sep 19 21:19:17 UTC 2018 x86_64 GNU/Linux

$ dotnet --list-sdks
2.1.403 [/opt/dotnet/sdk]

$ dotnet --list-runtimes
Microsoft.NETCore.App 2.1.5 [/opt/dotnet/shared/Microsoft.NETCore.App]
--------------------------------------------
Comment by Andre Soares (mniak) - Wednesday, 02 January 2019, 00:36 GMT
@Alucryd can I help with something?
Comment by Maxime Gauduin (Alucryd) - Wednesday, 02 January 2019, 19:59 GMT
I can reproduce with the latest sdk as well. Our sdk is built from source using Microsoft's source-build repository, that repository has 126 opened issues, so I'm not surprised there are broken things here and there. I'm definitely not reverting to bundling their binary blobs though.

Let's wait for Microsoft to chime in on github, all those it works on "distro X" or on "cloud z" comments over there aren't exactly helpful as these are probably all using binary blobs...
Comment by Sebastian Schloßer (Sebastian256) - Thursday, 03 January 2019, 14:21 GMT
@Alucryd thanks for the feedback. Did you find a specific issue for this problem on GitHub?
Comment by Standa Lukeš (exyi) - Thursday, 14 February 2019, 12:21 GMT
I think I found a workaround. You can basically use the Don Syme's guide "How to enable type providers with .NET Core 1" - https://github.com/Microsoft/visualfsharp/issues/3303. It requires aur/fsharp and runs the F# compiler on Mono which makes the type providers work, but produces .netstandard binaries. I just had to remove the 'msbuild-stable' dependency from the 'aur/fsharp' package as I have 'msbuild' installed.

Loading...