rdotnet/rClr

Error when returning Net class

juancentro opened this issue · 3 comments

I'm getting this error when trying to return a Net class

Error: object 'getCurrentConvertedObject' not found
Error in rClr::clrCallStatic(eikon_class_name, "GetValue", ric = ric,  : 
  Type:    RDotNet.EvaluationException
Message: Error: object 'getCurrentConvertedObject' not found

Method:  RDotNet.SymbolicExpression Parse(System.String, System.Text.StringBuilder)
Stack trace:
   en RDotNet.REngine.Parse(String statement, StringBuilder incompleteStatement)
   en RDotNet.REngine.<Defer>d__0.MoveNext()
   en System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source)
   en RDotNet.REngine.Evaluate(String statement)
   en Rclr.RDotNetDataConverter.get_CreateClrS4Object() en c:\Users\per202\AppData\Local\Temp\Rtmp8UJrfL\R.INSTALL23944e8d7aab\rClr\src\ClrFacade\RDotNetDataConverter.cs:línea 588
   en Rclr.RDotNetDataConverter.CreateClrObj(Object obj) en c:\Users\per202\AppData\Local\Temp\Rtmp8UJrfL\R.INSTALL23944e8d7aab\rClr\src\ClrFacade\RDotNetDataConverter.cs:línea 602
   en Rclr.RDotNetDataConverter.ConvertObject(Object obj) en c:\Users\per202\AppData\Local\Temp\Rtmp8UJrfL\R.INSTALL23944e8d7aab\rClr\src\ClrFacade\RDotNetDataConverter.cs:línea 558`

Are reference types automatically wrapped? What about structs?

jmp75 commented

What seems to happen is that R cannot find one of the R methods in rClr:
getCurrentConvertedObject

normally this function getCurrentConvertedObject should be known if library(rClr) was successful. I note that loading the full namespace rClr::getCurrentConvertedObject may be a good idea anyway for the next versions.

The C# code that calls this function is in the C# file.
public Function CreateClrS4Object

I will not expand on the reasons for this chain of callbacks, but this is necessary to expose arbitrary .NET objects in some circumstances.

Can you reproduce the issue in a small example that I could rerun?

I'm developing a package. I'll try to import the whole namespace or
directly depend on rclr.

On Mon, Aug 3, 2015, 21:51 J-M notifications@github.com wrote:

What seems to happen is that R cannot find one of the R methods in rClr:
getCurrentConvertedObject
https://github.com/jmp75/rClr/blob/master/R/rClr-exported.R#L314

normally this function getCurrentConvertedObject should be known if
library(rClr) was successful. I note that loading the full namespace
rClr::getCurrentConvertedObject may be a good idea anyway for the next
versions.

The C# code that calls this function is in the C# file.
public Function CreateClrS4Object
https://github.com/jmp75/rClr/blob/master/src/ClrFacade/RDotNetDataConverter.cs#L584

I will not expand on the reasons for this chain of callbacks, but this is
necessary to expose arbitrary .NET objects in some circumstances.

Can you reproduce the issue in a small example that I could rerun?


Reply to this email directly or view it on GitHub
#14 (comment).

The solution is to have rClr loaded. The workaround when developing a package is to depend (not import) rClr. This should be avoided, therefore, every function from rClr called from R.NET via an R engine object should be prefixed with rClr::