How fix the error 'Value can't be null'?


I really search and tried to fix this problem but I can’t at all. In fact, when I run my c# program. It stop at this line :


Showing this error:

System.ArgumentNullException: ‘The value can not be null’

For information engine is defined as:

REngine engine = REngine.GetInstance();

AND It’s really weird ! In fact engine work very well for this example in the same code :

var DataProd1 = engine.Evaluate(“DataProd1=DataDia[which(cond & DataDia$UserId %in% ID_Final),‘Produit.1’]”).AsNumeric();
var DataProd2 = engine.Evaluate(“DataProd2=DataDia[which(cond & DataDia$UserId %in% ID_Final),‘Produit.2’]”).AsInteger();
var DataProd3 = engine.Evaluate(“DataProd3=DataDia[which(cond & DataDia$UserId %in% ID_Final),‘Produit.3’]”).AsInteger();
var DataProd4 = engine.Evaluate(“DataProd4=DataDia[which(cond & DataDia$UserId %in% ID_Final),‘Produit.4’]”).AsInteger();

_ // Construction de la dataframe qui englobe tout les Id des produits_

_ ataFrame dfProp = engine.Evaluate(“dfProp=data.frame(ID_Final,DataProd1,DataProd2,DataProd3,DataProd4)”).AsDataFrame();

What does that means ? And how resolve it?


I suspect you won’t get much help with a general question like that in this forum. I suggest that you ask instead either on Stack Overflow (and clearly state that you’re using R.NET) or by creating an issue on the R.NET project on GitHub.

When you do, make sure to include the stack trace of your exception; ArgumentNullException is very general and it’s hard to diagnose it without knowing which method threw it.

.NET Foundation Website | Blog | Projects | Code of Conduct