2

FSLab template gives an error "The type provider 'RProvider.RProvider' reported an error: The type provider constructor has thrown an exception: Failed to start the R.NET server within 20 seconds"

I am using VS2015 and latest template from fslab.org

Anyone know how to work around this error? I get the same error when using VS2013 so I don't think it is related to VS.

eknutsen
  • 73
  • 4

2 Answers2

1

RProvider.Server.exe is expecting FSharp.Core v4.3.0.0 but is bundled with 4.4, if you run RProvider.Server.exe you should see the exception. A work around is to add a RProvider.Server.exe.config file to the same directory with a binding redirect.

kev
  • 11
  • 1
1

This is a pain. I am assuming you added FsLab from NuGet and tried building the project. As @kev says, the current stable version of FsLab (0.3.18) bundles the wrong version of FSharp.Core.dll. To see what @kev meant, go to the $YOUR_PROJECT_DIR/packages/RProvider.1.1.17/lib/net40 directory, open a command window there, and run RProvider.Server.exe to see the exception for yourself.

The cure is to create a binding redirect that would tell the runtime to look for the assembly version that is actually bundled (4.4.0.0) instead of the one it expects (4.3.0.0). To do this, create a file in the above mentioned directory, called RProvider.Server.exe.config, and paste the following into it...

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="4.3.0.0" newVersion="4.4.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

...and you should be good to go. To check, either run RProvider.Server.exe from the command line (it should give a different output to before) or rebuild your project to check that the error message stops appearing.

Obviously, this will hopefully just go away when the FsLab NuGet package gets sorted out.

mt99
  • 589
  • 3
  • 13