fslaborg / RProvider

Access R packages from F#
http://fslab.org/RProvider/
Other
235 stars 69 forks source link

Support R versions 3.5+ via R.NET 1.8.2 #205

Closed jmp75 closed 2 years ago

jmp75 commented 5 years ago
dsyme commented 3 years ago

@jmp75 Would you like to be a maintainer on this project?

jmp75 commented 3 years ago

@dsyme I can be if this helps. I am limited in the amount of time I can dedicate due to professional and personal reasons but happy to help when I can.

cgravill commented 3 years ago

I couldn't get this to build so I had a go at extending your change @jmp75 modernising the build infrastructure, with partial success, on here: https://github.com/cgravill/RProvider/tree/devel/rdotnet_netstandard2.0

It's building a .NET SDK style project, with dotnet Paket etc. However, it's not working as an actual TypeProvider when I reference it.

FSC : warning FS3005: Referenced assembly 'XYZ\forks\RProvider\src\RProvider\bin\Debug\net472\RProvider.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found [XYZ\forks\RProvider\tests\Test.RProvider\Test.RProvider.fsproj]
error FS3053 : The type provider 'RProvider.RProvider' reported an error : The type provider constructor has thrown an exception: ReflectionOnly loading is not supported on this platform. [XYZ\forks\RProvider\tests\Test.RProvider\Test.RProvider.fsproj]
    1 Warning(s)
    1 Error(s)

hopefully of some use to someone! My understanding from https://github.com/dotnet/fsharp/issues/3303 is that this shouldn't happen now but perhaps still have something out of date. If I get a chance I'll try digging again.

nhirschey commented 3 years ago

@cgravill, I can confirm type providers (in general) are working. I just finished updating FSharp.Data.Toolbox.*

cgravill commented 3 years ago

@nhirschey thanks for confirming. Any advice on the process? Do you know if it's a good idea to switch to .NET SDK for build but still .NET Framework with type providers?

I'd like to eventually get this working in .NET Core / .NET Interactive for a demo but was trying to do it incrementally. I haven't done much type provider authoring and would welcome any inputs.

nhirschey commented 3 years ago

@cgravill , I would also like to see this working again.

I know very little about type providers. I mostly had no idea what I was doing when I upgraded FSharp.Data.Toolbox. I just tried to kill intellisense and build errors via google.

I did it incrementally, so I know that a type provider can work with .NET SDK style projects that target .Net Framework type providers (and the Twitter provider still targets net47 because of its Forms usage).

Once you move to the .NET SDK, the type provider files need to be updated to use the new type provider SDK. Most of this for me was in this commit, see the */TypeProvider.fs files here https://github.com/fsprojects/FSharp.Data.Toolbox/commit/64cb3c87b9664c5b40f2298ecbb51498682f1756. I followed this documentation for syntax references: https://docs.microsoft.com/en-us/dotnet/fsharp/tutorials/type-providers/creating-a-type-provider.

If you look at the SAS provider, this pull request was sufficient to go from old style to new style https://github.com/fsprojects/FSharp.Data.Toolbox/pull/54/files. The Sas would build in VS and worked under .net framework and .net core. I just couldn't get the fake build to work. All my commits to the repo after that are fake fixes, documentation fixes, or trying to track down the change in how you need to reference embedded resources in the Twitter provider. If necessary, see this commit for the embedded resource change, which was the most frustrating to track down (https://github.com/fsprojects/FSharp.Data.Toolbox/commit/2db5d39e46f594e5a36eb8829ad479113bded3fe).

AndrewIOM commented 2 years ago

I'm going to close this PR, as I think it's been superseded by the work that was needed to get RProvider working on .net core. Thanks for all the work on this though!