Exception after upgrading to the latest version 4.2022.4.26

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
iMDsoft
Newbie
Newbie
Posts: 9
Joined: Tue Apr 26, 2022 12:00 am

Exception after upgrading to the latest version 4.2022.4.26

Post by iMDsoft » Wed Apr 27, 2022 2:46 pm

Hi,

After upgrading the teechart control to the latest version available (4.2022.4.26) from version (4.1.2014.12153) i'm getting an exception originating from teechart control i didn't had before:

System.ArgumentOutOfRangeException
HResult=0x80131502
Message=The parameter value must be greater than zero.
Parameter name: emSize
Source=PresentationCore
StackTrace:
at System.Windows.Media.FormattedText.ValidateFontSize(Double emSize)
at System.Windows.Media.FormattedText.InitFormattedText(String textToFormat, CultureInfo culture, FlowDirection flowDirection, Typeface typeface, Double emSize, Brush foreground, NumberSubstitution numberSubstitution, TextFormattingMode textFormattingMode, Double pixelsPerDip)
at Steema.TeeChart.WPF.Drawing.ChartFont.GetDrawingText(String text)
at Steema.TeeChart.WPF.Drawing.Graphics3DWPF.MeasureString(ChartFont f, String text)
at Steema.TeeChart.WPF.Drawing.Graphics3D.TextWidth(String text)
at Steema.TeeChart.WPF.Chart.bph(DrawingContext jkq, Boolean jkr)
at Steema.TeeChart.WPF.TChart.Draw(DrawingContext g)
at System.Windows.UIElement.Arrange(Rect finalRect)

This seems to be related to this issue:
http://support.steema.com/viewtopic.php ... 9587b8fb4e

but sadly I didn't find any solution or hint to the underlying problem in that post.

Can you please advise?
Attachments
exception.zip
(1.63 KiB) Downloaded 489 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by Christopher » Thu Apr 28, 2022 12:49 pm

Hello,

we're sorry to read you are experiencing this problem. At the end of the thread you refer to, you can read that we weren't successful in resolving the issue on these forums and got in touch directly with the client. Unfortunately, although the offer we made to the client in order that they could help us identify the problem was accepted, the client never got back to us with any results, despite our gentle reminders for them to do so.

I've just updated all our .NET Framework WPF examples (here I'm assuming you're using .NET Framework and not .NET 5/6) as you can see here. I've run all the examples in that folder using v.4.2022.4.26 but have not been able to reproduce your problem. Can you reproduce your problem using these examples? If not, could you please consider modifying one of these examples so we can reproduce this issue here?
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

iMDsoft
Newbie
Newbie
Posts: 9
Joined: Tue Apr 26, 2022 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by iMDsoft » Sun May 01, 2022 9:35 am

Our application is far more complex than a simple view as you have in your examples. And yes, we are suing .NET Framework 4.7

Before trying to reproduce this on a sample application, can you maybe advise me based on the supplied stack-trace and the source code for tee-chart what may cause this type of behavior?

Did we miss some property for the control that leaves the emSize for text as zero?
What type of properties directly affect emSize for the control?

We are using: Chart.Aspect.TextFormattingMode = TextFormattingMode.Ideal; unsure if its related.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by Christopher » Mon May 02, 2022 8:14 am

Hello,
iMDsoft wrote:
Sun May 01, 2022 9:35 am
Did we miss some property for the control that leaves the emSize for text as zero?
What type of properties directly affect emSize for the control?
The Font.Size property does. The last TeeChart method called in the stack trace is GetDrawingText, which looks like this:
Screenshot from 2022-05-02 10-04-39.png
Screenshot from 2022-05-02 10-04-39.png (92.88 KiB) Viewed 10557 times
If the Size is zero it will produce the error, but we do not set Size to zero anywhere in the TeeChart.WPF source code. One way to workaround this issue would be to check for zero every time this method is called, but this doesn't really get to the bottom of the issue, which is what is setting Size to zero in the first place. We would be interested in understanding the issue here, and if you're willing we could offer you temporary access to the TeeChart source-code so you could see for yourselves where this zero assignment is being made.
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

iMDsoft
Newbie
Newbie
Posts: 9
Joined: Tue Apr 26, 2022 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by iMDsoft » Mon May 02, 2022 12:10 pm

Ok, now that i understand the problem (font.size=0) somewhere in my code, i need to be able to understand which font.size is causing the issue.

I checked for example, the main TChart.FontSize and the Header font. and i saw that while the exception happens they are non-zero values.

How can i pinpoint which font instance exactly is zero value?

iMDsoft
Newbie
Newbie
Posts: 9
Joined: Tue Apr 26, 2022 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by iMDsoft » Mon May 02, 2022 12:37 pm

Ok, got some further details:

it appears that the font that has a value of font of the Graphjics3D font is zero.

What affects this value, and how can i change its value?
Attachments
Capture.PNG
Capture.PNG (27.02 KiB) Viewed 10552 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by Christopher » Mon May 02, 2022 2:43 pm

iMDsoft wrote:
Mon May 02, 2022 12:37 pm
What affects this value, and how can i change its value?
That Size is the Size I was referring to in my last message. What is of interest, to us, is understanding how this Size comes to be zero, especially given that in previous versions of TeeChart it did not happen (all client code being equal).

There is no universal way to change this value. The Graphics3DWPF is a 'painter', and paints all objects passed to it, many of which have Font properties of their own. So, for example, the Header class has a Font property, and when instantiated and the Chart is rendered, this Font property is assigned to the Graphics3DWPF.Font and the object is rendered. This means that client code may inadvertently be setting an Chart object's Font.Size to zero (e.g. that of the Header, the Axes, the Legend, etc. etc.) and it is this zero-sized Font.Size which is then assigned to Graphics3DWPF.Font which then causes the error when rendered.
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

iMDsoft
Newbie
Newbie
Posts: 9
Joined: Tue Apr 26, 2022 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by iMDsoft » Mon May 02, 2022 3:07 pm

But how can we pin-point which font instance (header/footer/etc) is causing the problem?
Can I set a default value for all font sizes that isn't zero for all font instances?
Was the font-size behavior changed in recent versions of teechart with a default value of zero for fonts compared with previous versions (that maybe had a nonzero default values) ?

I already tried finding all of the places we set the font size explicitly, and non of them had a non-zero value, so i assume the problematic place is somewhere that is taken a default value.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by Christopher » Mon May 02, 2022 3:15 pm

iMDsoft wrote:
Mon May 02, 2022 3:07 pm
Was the font-size behavior changed in recent versions of teechart with a default value of zero for fonts compared with previous versions (that maybe had a nonzero default values) ?
As I mentioned earlier, we do not set any Font.Size to zero anywhere in the Chart source code.
iMDsoft wrote:
Mon May 02, 2022 3:07 pm
But how can we pin-point which font instance (header/footer/etc) is causing the problem?
Can I set a default value for all font sizes that isn't zero for all font instances?
All our Chart primitives (Header etc.) are all already set to non-zero Font.Sizes. How to pin-point what is going on would be much easier with the Chart source-code, and as I said, I believe we'd be able to offer you temporary access to it in order to track down exactly where the problem is.
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

iMDsoft
Newbie
Newbie
Posts: 9
Joined: Tue Apr 26, 2022 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by iMDsoft » Mon May 02, 2022 3:41 pm

Ok, so I'm waiting for the source-code for the chart

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by Christopher » Mon May 02, 2022 3:49 pm

iMDsoft wrote:
Mon May 02, 2022 3:41 pm
Ok, so I'm waiting for the source-code for the chart
I will get in touch with the sales department who will send you an email to the email address associated with your account on these forums.
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

iMDsoft
Newbie
Newbie
Posts: 9
Joined: Tue Apr 26, 2022 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by iMDsoft » Tue May 03, 2022 7:53 am

Ok, this is getting really weird.

I've downloaded the source code for version 4.2022.2.11 compiled it myself with VS2022 (for .NET 4), replaced the assemblies in our project, and tried to reproduce the issue.
And to my complete surprise, everything works!

I then thought, maybe it is something with the recent version (4.2022.4.26), so i downloaded the compiled nuget for version (4.2022.2.11), and tried again, and sure enough, the emSize exception came back.

Just to make sure it was not a 'fluke', I again used the compiled assemblies I've compiled myself, and again, it simply worked.

How do you suggest we proceed?

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by Christopher » Tue May 03, 2022 8:49 am

iMDsoft wrote:
Tue May 03, 2022 7:53 am
Ok, this is getting really weird.

How do you suggest we proceed?
As you might have read on the other thread there is always the possibility that our obfuscation is causing an unwanted side-effect.

What I suggest therefore is that you run your code with the equivalent NuGet to the source-code, which is this one. Does this NuGet work with your code without the error?
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

iMDsoft
Newbie
Newbie
Posts: 9
Joined: Tue Apr 26, 2022 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by iMDsoft » Tue May 03, 2022 9:10 am

As I stated in my original post, I've already performed that test, and used the equivalent NuGet to the source-code, and got the same exception.
Only when using the code that I've compiled locally, It was working as intended.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Exception after upgrading to the latest version 4.2022.4.26

Post by Christopher » Tue May 03, 2022 9:30 am

iMDsoft wrote:
Tue May 03, 2022 9:10 am
As I stated in my original post, I've already performed that test, and used the equivalent NuGet to the source-code, and got the same exception.
Ah yes, sorry, I missed that.

I've just sent you an email with a link to a rebuild of the v.4.2022.2.11 assemblies but without either obfuscation or signing. Please let us know whether these assemblies also give you the same error or not.
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

Post Reply