Reputation: 3
I'm trying to debug C# methods that are called from R by means of rClr. In the VS-project I have set the the start action property to start Rscript.exe with the R-script as commandline parameter. (Similar to what you would do e.g. to debug c# functions called from Excel using ExcelDNA.) The R-script runs as expected, but execution doesn't stop at the breakpoints. So I'm not able to do any debugging from Visual Studio.
What am I doing wrong?
Here is a minimal example:
C#-code in VS-project RLib1 - Calculates.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RLib1
{
public class Calculate {
public static double Sum(double x1, double x2) {
return x1 + x2;
}
}
}
Properties in RLib1.csproj
Start external program: c:\R\R-3.3.2\bin\Rscript.exe
Command line arguments: c:\VSProjects\RLib1\TestRLib1.R
R-script in TestRLib1.R
library(rClr)
clrLoadAssembly('C:/VSProjects/RLib1/RLib1/bin/Debug/RLib1.dll')
clrGetTypesInAssembly("RLib1")
clrCallStatic("RLib1.Calculate","Sum",2,5)
Upvotes: 0
Views: 119
Reputation: 1554
You may want to use the "Attach to process" feature of visual studio as it is a bit more transparent in terms of debugging behavior; see https://github.com/jmp75/rClr/issues/32 for details.
Upvotes: 0