Open-Systems-Pharmacology / rSharp

R package for communication with .NET Core
http://www.open-systems-pharmacology.org/rSharp/
GNU General Public License v2.0
1 stars 0 forks source link

Passing array of lenght 1 to .NET #108

Open PavelBal opened 8 months ago

PavelBal commented 8 months ago

Currently not supported as R always converts an array of length 1 to a scalar.

test_that("Basic types of length one are passed correctly from R to .NET", {
  expectArrayElementType(numeric(1), "System.Double")
  expectArrayElementType(integer(1), "System.Int32")
  expectArrayElementType(raw(1), "System.Byte")
  expectArrayElementType(logical(1), "System.Boolean")
  expectArrayElementType(character(1), "System.String")
  expectArrayElementType("a", "System.String")
})
Error in do.call(".External", c(list("r_call_static_method", typename,  : 
  Type:    System.MissingMethodException
Message: Could not find a suitable static method CheckElementType on type ClrFacade.TestArrayMemoryHandling for method parameters Double, RuntimeType
Method:  Void ThrowMissingMethod(System.Type, System.String, System.String, System.Type[])
Stack trace:
   at ClrFacade.ReflectionHelper.ThrowMissingMethod(Type classType, String methodName, String modifier, Type[] types) in D:\Work\OSPS\Repos\rSharp\shared\ClrFacade\ReflectionHelper.cs:line 790
   at ClrFacade.Internal.InternalCallStaticMethod(Type classType, String methodName, Boolean tryUseConverter, Object[] arguments) in D:\Work\OSPS\Repos\rSharp\shared\ClrFacade\Internal.cs:line 98
   at ClrFacade.Internal.CallStaticMethod(String typename, String methodName, Object[] objects) in D:\Work\OSPS\Repos\rSharp\shared\ClrFacade\Internal.cs:line 105
   at ClrFacade.Internal.CallStaticMethod(String typename, String methodName, IntPtr arguments, Int32 numObjects, IntPtr returnValue) in D:\Work\O
PavelBal commented 8 months ago

https://github.com/Open-Systems-Pharmacology/rSharp/blob/4bbb33b3ec3c3ffa872b4d047f44997508cbccc4/tests/testthat/test-array.R#L42