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

`ToString` fails for `NULL`? #111

Closed PavelBal closed 8 months ago

PavelBal commented 8 months ago
> toStringNET(NULL)
Error in do.call(".External", c(list("r_call_static_method", typename,  : 
  Type:    System.NullReferenceException
Message: Object reference not set to an instance of an object.
Method:  System.String ToString(System.Object)
Stack trace:
   at ClrFacade.InternalRSharpFacade.ToString(Object obj)
   at ClrFacade.ClrFacade.ToString(Object obj)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
3.
do.call(".External", c(list("r_call_static_method", typename,
methodName), args, PACKAGE = rSharpEnv$nativePkgName)) at utilities-static.R#60
2.
callStatic(rSharpEnv$clrFacadeTypeName, "ToString", x) at utilities.R#34
1.
toStringNET(NULL)

ToString should catch NULL and return NULL as string?

PavelBal commented 8 months ago

Fixes by https://github.com/Open-Systems-Pharmacology/rSharp/pull/123