XamlParseException - ArgumentOutOfRangeException when feeding empty series from another thread

Hi

I have an sfChart with a Candle series. The view model is being fed data from another thread, and a dispatch timer is being used to regulate the update to the ObservableCollection which is feeding the series.

This works fine when some candles are pre-loaded and then the feed starts.

But if the series has no candles yet, and the feed starts, then sometimes the system throws an ArgumentOutOfRangeException. It is inconsistent, so I cannot reliably reproduce it, but I would say it happens about 33% of the time. 

I cannot debug because it is in external code. 

Are there any thoughts what could be causing the exception, or how I can best handle it?

I can add my implementation if needed, but seeing if there is a simple answer on the cause.


Here is the stack trace.

System.Windows.Markup.XamlParseException

  HResult=0x80131501

  Message=Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')

  Source=PresentationFramework

  StackTrace:

   at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)

   at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri)

   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)

   at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)

   at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)

   at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)

   at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)

   at System.Windows.FrameworkElement.ApplyTemplate()

   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)

   at System.Windows.UIElement.Measure(Size availableSize)

   at Syncfusion.UI.Xaml.Charts.ChartTrackBallBehavior.AddTrackBall(ChartPointInfo pointInfo)

   at Syncfusion.UI.Xaml.Charts.ChartTrackBallBehavior.GenerateAdditionalTrackball(ChartPointInfo pointInfo)

   at Syncfusion.UI.Xaml.Charts.ChartTrackBallBehavior.GenerateTrackBalls()

   at Syncfusion.UI.Xaml.Charts.ChartTrackBallBehavior.OnPointerPositionChanged()

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

   at System.Windows.Threading.DispatcherOperation.InvokeImpl()

   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)

   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

--- End of stack trace from previous location ---

   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)

   at System.Windows.Threading.DispatcherOperation.Invoke()

   at System.Windows.Threading.Dispatcher.ProcessQueue()

   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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)

   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)

   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)

   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)

   at System.Windows.Threading.Dispatcher.Run()

   at System.Windows.Application.RunDispatcher(Object ignore)

   at System.Windows.Application.RunInternal(Window window)

   at System.Windows.Application.Run()

   at TradingToolsDesktopWPF.App.Main()


  This exception was originally thrown at this call stack:

    [External Code]


Inner Exception 1:

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')






6 Replies 1 reply marked as answer

DD Devakumar Dhanapoosanam Syncfusion Team February 11, 2022 02:59 PM UTC

Hi Lorenzo, 
 
We are currently checking the reported issue based on the provided details and we will update you complete details in one business day on 14th February 2022. 
 
Regards, 
Devakumar D 



DD Devakumar Dhanapoosanam Syncfusion Team February 14, 2022 12:47 PM UTC

Hi Lorenzo, 
 
We were able reproduce the reported issue using CandleSeries with single data point and enabling the chart TrackballBehavior. Currently we are validating this issue at our end and will update you further details on February 15, 2022. 
 
Regards, 
Devakumar D 



LO Lorenzo February 14, 2022 01:08 PM UTC

That's great! Thanks



DD Devakumar Dhanapoosanam Syncfusion Team February 16, 2022 04:18 AM UTC

Hi Lorenzo, 
 
On further analysis we have confirmed that "ArgumentOutOfRangeException is thrown when using single data with financial series and enable the trackball" as an issue, and the fix for the reported issue will be included in our upcoming weekly NuGet release which is expected to be roll out on March 1, 2022. We appreciate your patience until then. We will let you know once it gets rolled out.         
 
Note: The provided feedback link is private, and you need to login to view this feedback. 
 
Regards, 
Devakumar D 



YP Yuvaraj Palanisamy Syncfusion Team March 1, 2022 07:17 PM UTC

Hi Lorenzo,  
 
We have fixed the reported problem “Throws out of range exception when Trackbal with single data” and due to some automation test case pending, we are not included the fix in the weekly nuget release. And this fix will be included in our upcoming weekly nuget release which expected to be roll out on 8th March, 2022. Also, we have generated the patch for this fix. Once rolled out we will let you know until then please use the below patch. 
   
   
   
   
Assembly Version: 19.4.0.48   
       
Disclaimer:     
    
Please note that we have created this patch for version 19.4.0.48 specifically to resolve the issue reported in this incident. If you have received other patches for the same version for other products, please apply all patches in the order received.   
      
    
Please clear the NuGet cache, before using the latest one.
https://www.syncfusion.com/kb/6987/how-to-clear-nuget-cache     
    
 
Regards, 
Yuvaraj. 



YP Yuvaraj Palanisamy Syncfusion Team April 6, 2022 05:13 AM UTC

Hi Lorenzo,


We are glad to announce that our Essential Studio 2022 Volume 1 main release v20.1.0.47 is rolled out and is available for download under the following link.


Essential Studio 2022 Volume 1 Main Release v20.1.0.47 is available for download | Announcements Forums | Syncfusion


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Regards,

Yuvaraj.


Marked as answer
Loader.
Up arrow icon