FSharp.Configuration icon indicating copy to clipboard operation
FSharp.Configuration copied to clipboard

Typeprovider constructor error when built using dotnet from command prompt

Open priv22 opened this issue 6 years ago • 7 comments
trafficstars

The type provider 'FSharp.Configuration.ConfigTypeProvider+FSharpConfigurationProvider' reported an error : The type provider constructor has thrown an exception: System.Runtime.Caching is not supported on this platform.

I am figuring out F#... I can build it and run it without errors in Visual Studio. But when I try to build it from the command prompt using dotnet build, I get the above error.

Advise please

priv22 avatar Nov 13 '19 20:11 priv22

It doesn't look like this is maintained any longer. It's not currently targeting dotnet core, so it will only work with framework applications.

Shmew avatar Dec 06 '19 21:12 Shmew

What version of TP and run do you use ? FSharp.Configuration 2.0.0-alpha2 should work on .NET Core

sergey-tihon avatar Dec 07 '19 08:12 sergey-tihon

It's still failing on MacOs. I managed to use FSharp.Configuration on Windows using 2.0.0-alpha2 and the workaround for Type Providers with the file fsc.props. But still it won't compile on MacOs. When I add the file fsc.props the error I get is: FSC : error FS0226: The file extension of '/usr/local/share/dotnet/sdk/3.1.100/FSharp/fsc.exe' is not recognized. Source files must have extension .fs, .fsi, .fsx, .fsscript, .ml or .mli.

eacasanovaspedre avatar Dec 11 '19 15:12 eacasanovaspedre

On Linux, using dotnet code 3.1, ionide reports this error:

The type provider 'FSharp.Configuration.ConfigTypeProvider+FSharpConfigurationProvider' reported an error: The type provider constructor has thrown an exception: System.Runtime.Caching is not supported on this platform.F# Compiler(3053)
Referenced assembly '/home/rb/.nuget/packages/fsharp.configuration/2.0.0-alpha2/lib/netstandard2.0/FSharp.Configuration.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were foundF# Compiler(3005)

I can compile it without error from the command line, but I'm not sure which is the correct behaviour.

rbauduin avatar Dec 21 '19 16:12 rbauduin

This doesn't happen when using Visual Studio 2019. It only occurs when using vscode or neovim with Ionide. I couldn't try the (non-Ionide) F# Language Server in vscode since that appears to be broken. And I don't have Rider (unfortunately!).

I have the same issue on MacOS, Windows and Linux using version 2.0.0-alpha2 and dotnet 3.1.102 (also 2.1.300). This is when referencing the package, it doesn't need an open statement to raise the error.

I imagine this is why it works for Sergey but not for others...

I wonder whether we should we be raising this in the FSAC or Ionide repos instead?

Just repeating the error messages here without scrollbars for legibility:

The type provider 'FSharp.Configuration.ConfigTypeProvider+FSharpConfigurationProvider' reported an error: The type provider constructor has thrown an exception: System.Runtime.Caching is not supported on this platform. F# Compiler(3053)

Referenced assembly 'C:\Users\usrname\.nuget\packages\fsharp.configuration\2.0.0-alpha2\lib\netstandard2.0\FSharp.Configuration.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found. F# Compiler(3005)

drk-mtr avatar Mar 05 '20 21:03 drk-mtr

There's an issue in ionide that I've referenced in https://github.com/fsharp/FsAutoComplete/issues/565, that I believe is related. It's on my radar, trying to see when I'll have time to investigate.

baronfel avatar Mar 05 '20 21:03 baronfel

Ah good to hear - thanks!

drk-mtr avatar Mar 05 '20 21:03 drk-mtr