1

Closed

Exception handling on MS.NET - error messages

description

The lack of details on exceptions in the MS CLR hosting API has been a bug bear. Tried to print stack traces in C# using R.NET and calling Rf_error in the R API. Seemed to work, however I get a crash of R if I run test_package('rClr') more than once. If attached to VS, the first run of the tests complains as below:
Managed Debugging Assistant 'Reentrancy' has detected a problem in 'C:\Program Files\R\R-3.0.0\bin\x64\Rgui.exe'.

Additional Information: Attempting to call into managed code without transitioning out first.  Do not attempt to run managed code inside low-level native extensibility points, such as the vectored exception handler, since doing so can cause corruption and data loss.

If there is a handler for this exception, the program may be safely continued.
This is really really bad: it freezes VS as well.
Closed Sep 21, 2013 at 1:28 AM by jperraud
Returning the innermost exception as of 2013-09-21

comments

jperraud wrote Aug 20, 2013 at 5:45 AM

Useful docco page:
http://msdn.microsoft.com/en-us/library/ms172237.aspx

Have worked around this. Note however that this raises some potential import issues with C calling C# with interop code back to the same C program ( R using rClr using R.NET tapping into R API functions an issue?)

jperraud wrote Aug 27, 2013 at 1:18 AM

Noticed while diagnosing issue 70, in passing: I need to have access to the full stack trace inclusing inner exceptions. clrTraceback(). After all, probably very similar to the default R error handling :-)