This is a migrated thread and some comments may be shown as answers.

Exception has thrown in telerik chartview control

4 Answers 197 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Senthil kumar
Top achievements
Rank 1
Senthil kumar asked on 31 Jan 2014, 11:05 AM
 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()

4 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 03 Feb 2014, 09:00 AM
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 >>
0
Anthony
Top achievements
Rank 1
answered on 19 Nov 2014, 03:20 PM
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()



0
Petar Marchev
Telerik team
answered on 20 Nov 2014, 12:55 PM
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.

 
0
Anthony
Top achievements
Rank 1
answered on 21 Nov 2014, 11:46 AM
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.

Tags
General Discussions
Asked by
Senthil kumar
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Anthony
Top achievements
Rank 1
Share this question
or