Skip to content

Running an fsx script from "Reading and writing RData files" with fsi throws a System.Reflection.TargetInvocationException exception. #262

@EverybodyKurts

Description

@EverybodyKurts

Describe the bug

Running an fsx script from Reading and writing RData files with fsi throws a System.Reflection.TargetInvocationException exception.

To Reproduce

Create a script that loads sample.rdata as shown in the Reading and writing RData files example:

open RProvider

type Sample = RData<"data/sample.rdata">
let sample = Sample()

// Easily access saved values
sample.volcano
sample.volcanoList
sample.volcanoMean

Run it in VSCode (with Ionide installed) via the Command Pallette via send file OR run it on the command line with the following command:

% dotnet fsi script.fsx
chmod: '/Users/mueller.128/.nuget/packages/rprovider/2.1.0/lib/net5.0/server/osx-arm64/RProvider.Server': No such file or directory
Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file '/Users/mueller.128/.packagemanagement/nuget/Cache/sample.rdata', probable reason 'No such file or directory'


/Users/mueller.128/Developer/comrit/imrp-frontend/script.fsx(5,15): error FS3033: The type provider 'RProvider.RDataProvider' reported an error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.Exception: Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection

   at RProvider.Server.EventLoop.runServerCommandSafe[a](FSharpFunc`2 f) in /Users/runner/work/RProvider/RProvider/src/RProvider.Server/RInteropServer.fs:line 78
   at RProvider.Server.RInteropServer.RProvider.Internal.IRInteropServer.GetRDataSymbols(String file) in /Users/runner/work/RProvider/RProvider/src/RProvider.Server/RInteropServer.fs:line 107
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at PipeMethodCalls.RequestHandler`1.GetTypedResponseForRequest(SerializedPipeRequest request)

Expected behavior

The script to run successfully without throwing an error.

Screenshots

Screen Shot 2023-01-07 at 4 47 35 PM

Environment (please complete the following information):

  • OS: macOS, arm64
  • OS Version: 12.6.2
  • using it in an fsx script
  • RProvider Version: 2.1.0
  • Installed R Version: 4.2.2

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions