Hello,
We get spurious error messages with "Index out of Bounds" Exceptions in Steema.TeeChart.Styles.ValueList
[img]TeeChartAbsturz-neueTeeChartVersion.png[/img]
We have an application that makes heavy use of background initialization and update of TeeChart Series.
Could it be that TeeChart ist not thread safe?
Best regards
Wallenstein
Teechart .NET Styles.Series Index out of Bounds
-
- Newbie
- Posts: 5
- Joined: Wed Jan 17, 2018 12:00 am
Teechart .NET Styles.Series Index out of Bounds
- Attachments
-
- Screenshot
- TeeChartAbsturz-neueTeeChartVersion.png (497.67 KiB) Viewed 15781 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Teechart .NET Styles.Series Index out of Bounds
It would be more accurate to say that GDI+ is not thread safe [from here]: TeeChart has no automatic synchronization mechanism because GDI+ has no automatic synchronization mechanism, which means that if you are using a TeeChart object which refers to a GDI+ object in a multithreaded application you will have to 'place the call inside a critical section, or use some other standard synchronization technique.'Wallenstein wrote: Could it be that TeeChart ist not thread safe?
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 5
- Joined: Wed Jan 17, 2018 12:00 am
Re: Teechart .NET Styles.Series Index out of Bounds
Hello Christopher,
Ah OK. Thank you for your prompt reply.
Unfortunatelly the OnPaint-call is not initiated by us, but by Windows.Forms. So what would be your recommendation for thread based implementations?
How can we ensure that TeeChart is not painting during an series update?
Best regards
Michael
Ah OK. Thank you for your prompt reply.
Unfortunatelly the OnPaint-call is not initiated by us, but by Windows.Forms. So what would be your recommendation for thread based implementations?
How can we ensure that TeeChart is not painting during an series update?
Best regards
Michael
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Teechart .NET Styles.Series Index out of Bounds
If the TChart object is running on the same thread as the Series object there is no problem. The problems occur when they are run on different threads. If this is the case, then updates to the Series object should be placed inside a critical section.Wallenstein wrote: How can we ensure that TeeChart is not painting during an series update?
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 5
- Joined: Wed Jan 17, 2018 12:00 am
Re: Teechart .NET Styles.Series Index out of Bounds
Hello Christopher,
What is the thisLock-Object that is also used by teechart to synchronize the paint-Method?
Michael
Yes that is clear, however your example of an critical section requires a lock:If the TChart object is running on the same thread as the Series object there is no problem. The problems occur when they are run on different threads. If this is the case, then updates to the Series object should be placed inside a critical section.
Code: Select all
lock (thisLock) {
... do something critical
}
Michael
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Teechart .NET Styles.Series Index out of Bounds
Hello,
To quote from the link in my last message:Wallenstein wrote: What is the thisLock-Object that is also used by teechart to synchronize the paint-Method?
as it's a private object then it is not used outside the thread in which it is defined.Best practice is to define a private object to lock on, or a private static object variable to protect data common to all instances.
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 5
- Joined: Wed Jan 17, 2018 12:00 am
Re: Teechart .NET Styles.Series Index out of Bounds
Hello Christopher,
We have done various synchronizations in our applications. However we are still suffering from Index-Out-Of-Bounds problems:
As you see from this stacktrace, the FastLine Draw-Method is Inserting Values into the ValueList.
Why is it doing this? What points are here inserted? The FastLine was already be filled with all necessary points.
Best regards
Michael
We have done various synchronizations in our applications. However we are still suffering from Index-Out-Of-Bounds problems:
As you see from this stacktrace, the FastLine Draw-Method is Inserting Values into the ValueList.
Why is it doing this? What points are here inserted? The FastLine was already be filled with all necessary points.
Best regards
Michael
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Teechart .NET Styles.Series Index out of Bounds
Hello Michael,
In order to resolve this issue I will need some code with which I can reproduce it here - could you please provide me with some?
the FastLine series fills an internal valuelist with values when its Clicked() method is called as a speed optimization, and this Clicked() method is called by the MarksTip tool. Just by looking at the code I can't imagine why it should fail, and certainly all the tests I've run on the code haven't caused it to fail in this way, e.g.Wallenstein wrote: Why is it doing this? What points are here inserted? The FastLine was already be filled with all necessary points.
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
FastLine series1 = new FastLine(tChart1.Chart);
series1.FillSampleValues(10000);
series1.DrawAllPoints = false;
MarksTip tool1 = new MarksTip(tChart1.Chart);
tool1.Series = series1;
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |