Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

Commented Unassigned: C# App crashes while getting row from dataframe [150]

$
0
0
Hi,
Can anyone help me on this.
I am facing this weird issue, when I try to fetch some rows(row by row) from my dataset(dataframe in R). First few rows are fetched without any error but after say 4-5 rows I get some exception on a line which executed perfectly for first few rows.
I am executing following statement:

SomeRDotNetObject.Evaluate("Dataset1[rowindex , ]" ); // Dataset1 is the name of the dataset

for say rowindex= 1 to 4 this works but fails on rowindex=5. And C# application crashes with following exception:-

_System.Windows.Threading.DispatcherUnhandledExceptionEventHandler -METHOD :Invoke() -LINE :0
System.InvalidOperationException: Dispatcher processing has been suspended, but messages are still being processed.
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)_


Thanks
adabral
Comments: Hi skyguy94, Thanks for looking into my issue. My WPF app is written in Windows OS. As a global (or top level) exception handler I am using following: _ Dispatcher.UnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler( MyDispatcher_UnhandledException );_ Even though, I have R.Net's Evaluate() method within 'try' block, the 'catch' is not handling the exception ( which probably is thrown by R.dll ). Following code is little bit summarised(dont worry about null exception in last line) SymbolicExpression se=null; try { se = SomeRDotNetObject.Evaluate("Dataset1[rowindex , ]" ); // Dataset1 is the name of the dataset } catch(Exception e) { } string[] rowdata = se.AsCharacter().ToArray();// While rendering, my datagrid has got some logic that requests a row at a time from R.Net. So, datagrid will request for say row index 1 and gets the data row using R.Net, then requests row index 2 using R.Net then row index 3 and so on. Evalute() will return one row at a time. First 4 rows are fetched without any issue but then for the fetching the next row (say 5th row) the statement inside of 'try' block fails and exception is thrown which is caught by the "MyDispatcher_UnhandledException" and not caught by the 'catch' block. I used debug mode to find out that first few rows are fetched but then for next row exception is thrown. I tried different Datasets, thinking that, may be row has some bad data, but no difference. The R command that I am executing inside Evaluate() is "Dataset1[rowindex , ]" A row of data in 'rowdata' may look like following for dataset having 3 columns. "12" "111" "345" I hope, now I explained it properly. Its weird, that same Evalute() works first few times and then it fails even though there are couple rows left to fetch. (there is no index out of bound situation). Thanks, adabral

Viewing all articles
Browse latest Browse all 1634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>