0

I'm getting the exception 'System.Runtime.InteropServices.SEHException' in RDotNet.dll

by running a simple R script:

n + minWidth

with this code in c#:

// Load the R environment
REngine.SetEnvironmentVariables();
REngine engine = REngine.GetInstance();

// Load the input data
CharacterVector charVec = engine.CreateCharacterVector(new List<string> { csvFileName });
engine.SetSymbol("input", charVec);
engine.SetSymbol("n", engine.CreateNumeric(numberOfFanfolds));
engine.SetSymbol("minWidth", engine.CreateNumeric(minWidth));
engine.SetSymbol("minScrap", engine.CreateNumeric(minScrap));
engine.SetSymbol("cardboardStep", engine.CreateNumeric(cardboardStep));

// Run the script
results = await Task.Factory.StartNew(() => engine.Evaluate("source('" + script_file_ + "')"));

When i try to run the code directly it works correctly:

var results = await Task.Factory.StartNew(() => engine.Evaluate("n + minWidth"));

What does it means? What can I do? Do I need to format the R script in some way?

Michele mpp Marostica
  • 2,445
  • 4
  • 29
  • 45

1 Answers1

0

Just need to rearrange the file path

script_file_ = scriptFile.Replace("\\", "/");
Michele mpp Marostica
  • 2,445
  • 4
  • 29
  • 45