Exception has thrown in telerik chartview control

5 posts, 0 answers
  1. Senthil kumar
    Senthil kumar avatar
    21 posts
    Member since:
    Sep 2013

    Posted 31 Jan 2014 Link to this post

     The following exception has been thrown when chartview loading in screen.

    at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
       at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
       at System.Collections.Generic.List`1.Enumerator.MoveNext()
       at Telerik.Charting.DataPointCollection`1.<System.Collections.Generic.IEnumerable<Telerik.Charting.DataPoint>.GetEnumerator>d__0.MoveNext() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\DataPoints\DataPointCollection.cs:line 88
       at Telerik.Charting.DateTimeContinuousAxisModel.BuildValues(AxisUpdateContext context) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\Axes\Continuous\DateTimeContinuousAxisModel.cs:line 899
       at Telerik.Charting.DateTimeContinuousAxisModel.UpdateCore(AxisUpdateContext context) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\Axes\Continuous\DateTimeContinuousAxisModel.cs:line 289
       at Telerik.Charting.AxisModel.Update(AxisUpdateContext context) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\Axes\AxisModel.cs:line 497
       at Telerik.Charting.ChartAreaModelWithAxes.UpdateAxis(AxisModel axis, IList`1 series) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ChartAreas\ChartAreaModelWithAxes.cs:line 387
       at Telerik.Charting.ChartAreaModelWithAxes.UpdateAxes() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ChartAreas\ChartAreaModelWithAxes.cs:line 340
       at Telerik.Charting.ChartAreaModelWithAxes.ArrangeOverride(RadRect rect) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ChartAreas\ChartAreaModelWithAxes.cs:line 190
       at Telerik.Charting.ChartNode.Arrange(RadRect rect, Boolean shouldRoundLayout) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ElementTree\ChartNode.cs:line 214
       at Telerik.Charting.ChartAreaModel.Arrange() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Engine\ChartAreas\ChartAreaModel.cs:line 94
       at Telerik.Windows.Controls.ChartView.RadChartBase.UpdateChartArea() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\RadChartBase.cs:line 720
       at Telerik.Windows.Controls.ChartView.RadChartBase.CallUpdateUI() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\RadChartBase.cs:line 1006
       at Telerik.Windows.Controls.ChartView.RadChartBase.OnInvalidated() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\RadChartBase.cs:line 982
       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)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext 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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(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.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at Vestas.Servicetool.Toolcontainer.App.Main() in C:\Views\SEKUM_VOToolkit_4.3.0\FirecrestUI\Servicetool\Servicetool\Toolcontainer\obj\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  2. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 03 Feb 2014 Link to this post

    Hi Senthil,

    Thank you for the attached stack trace. However, it does not help us too much because we cannot reproduce it based on the information given.

    Are you perhaps doing anything asynchronously, like loading data in a different thread? If you need our assistance with this I will ask that you prepare a small project that we can run and that reproduces the issue at hand.

    Regards,
    Petar Marchev
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Anthony
    Anthony avatar
    2 posts
    Member since:
    Nov 2014

    Posted 19 Nov 2014 in reply to Petar Marchev Link to this post

    Petar,

    Probably I am jumping in late on this one. I am facing very similar issue and as you have indicated an I have series being updated from a different thread (this is a SilverLight application). Any suggestions of guidelines on how to update a data series from a different thread?
    ====================================================================================================
    Collection was modified; enumeration operation may not execute.   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
       at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
       at System.Collections.Generic.List`1.Enumerator.MoveNext()
       at Telerik.Charting.DataPointCollection`1.<System.Collections.Generic.IEnumerable<Telerik.Charting.DataPoint>.GetEnumerator>d__0.MoveNext()
       at Telerik.Charting.DateTimeContinuousAxisModel.BuildValues(AxisUpdateContext context)
       at Telerik.Charting.DateTimeContinuousAxisModel.UpdateCore(AxisUpdateContext context)
       at Telerik.Charting.AxisModel.Update(AxisUpdateContext context)
       at Telerik.Charting.ChartAreaModelWithAxes.UpdateAxis(AxisModel axis, IList`1 series)
       at Telerik.Charting.ChartAreaModelWithAxes.UpdateAxes()
       at Telerik.Charting.ChartAreaModelWithAxes.ArrangeOverride(RadRect rect)
       at Telerik.Charting.ChartNode.Arrange(RadRect rect, Boolean shouldRoundLayout)
       at Telerik.Charting.ChartAreaModel.Arrange()
       at Telerik.Windows.Controls.ChartView.RadChartBase.UpdateChartArea()
       at Telerik.Windows.Controls.ChartView.RadChartBase.CallUpdateUI()
       at Telerik.Windows.Controls.ChartView.RadChartBase.OnInvalidated()



  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 20 Nov 2014 Link to this post

    Hello Anthony,

    I hope you understand that the chart is a UI control and its data should only be passed and updated in the chart's UI thread. This means that you will need to update the collection only in the same thread as the one the chart was created in. You can use the chart's dispatcher to invoke an action.

    We cannot suggest a general way to update a data from a different thread (if it was WPF you could use the application's dispatcher). You may need to provide a way for your view models to know about the dispatcher they are running on, so that they update the data only via the dispatcher. I hope this information helps.

    Regards,
    Petar Marchev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Anthony
    Anthony avatar
    2 posts
    Member since:
    Nov 2014

    Posted 21 Nov 2014 in reply to Petar Marchev Link to this post

    Petar,

    Thank you for this insight. I have restructured my code to update the series from the same UI thread and I have not observed the exception so far which used to happen randomly.

Back to Top
UI for WPF is Visual Studio 2017 Ready