Page 1 of 1

net6 and net4 (winform) and handling of chart settings

Posted: Mon Apr 24, 2023 6:05 pm
by 16095093
Hi,

We are in the process of updating to the latest version of TeeChart and we have discovered a significant issue. The .net6 (winform) version cannot read net4x chart settings (and vice-versa *).

We considered reading the net4 settings and saving them using json serialization so the net6 version could read them (*). But the net4x and net6 objects are different. So that is not a viable option for us (teechart net4x settings can’t even be saved to json). I see no easy workaround for us.

Given the importance of preserving charts settings, the fundamental nature of this functionality, and the fact that implementation choices have made this unrealistic for us/other end-users to tackle -- we’re wondering what you offer for solving this dilemma? Is this something you are actively working on?

(*) Note: We will continue to have a need to support net4x and net6 going forward (we target both platforms from single-source). So, it will be important for the net4x version to be able to read net6 settings as well.

Thanks,

Kris Culin
Bentley Systems, Inc.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Tue Apr 25, 2023 11:12 am
by Christopher
Hello Kris,
Kris C wrote:
Mon Apr 24, 2023 6:05 pm
Given the importance of preserving charts settings, the fundamental nature of this functionality, and the fact that implementation choices have made this unrealistic for us/other end-users to tackle -- we’re wondering what you offer for solving this dilemma? Is this something you are actively working on?
No, it is not, and no, at the moment we cannot offer anything to clients who wish to make our .NET 4.x binary format export compatible with our .NET 6 Json export. In fact, even within our suite of .NET 4.x products our binary format was not universal, as for example between our Windows Forms and WPF versions. This is the improvement we made for .NET 5/6 in this area, that our Json format should be universal between platforms (WinForm, WPF, and Server).

I've added this as an enhancement to our issue tracker with id=2608. In the meantime, I have an idea that I may be able to share with you, as a sourcecode client, but first I will have to check quite how feasible it is.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Tue Apr 25, 2023 11:47 am
by 16095093
We very much appreciate that you've added this as an enhancement for future consideration.

We look forward to any ideas you might share to help us deal with this particular situation until (and if) you decide to implement the enhancement.

Kris

Re: net6 and net4 (winform) and handling of chart settings

Posted: Tue Apr 25, 2023 3:52 pm
by Christopher
Hello Kris,
Kris C wrote:
Tue Apr 25, 2023 11:47 am
We look forward to any ideas you might share to help us deal with this particular situation until (and if) you decide to implement the enhancement.
The idea I had is feasible, which is the good news. The bad news is that the solution demonstrates what is possibly the same problem with System.Text.Json v7.0.0.0 as the one you encountered:

Code: Select all

System.IO.FileLoadException
  HResult=0x80131040
  Message=Could not load file or assembly 'System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Source=TeeChart
  StackTrace:
In our case, the solution is to copy across the correct version of System.Text.Json (Visual Studio 2022 copies across v6.0.0.0) along with a couple of sub-dependencies that Visual Studio 2022 also misses.

The solution consists of, essentially, replacing the .NET 6.0 TeeChart.WinForm wrapper of the .NET Standard 2.0 TeeChart with a .NET Framework 4.8 WinForm wrapper of it. This has required the addition of a compile conditional to semaphore some of the C# 8.0 syntax we use, meaning that it's not so easy for us to pass across the changes to you. What we can offer you, if you're interested, is a compilation of this assembly; this technique allows you to use the same Json serialization across both net48 and net60.

We still use the 'old' single-assembly TeeChart for .NET Framework 4.x for backwards compatibility, this serialization issue being a major issue, but there's nothing stopping us shipping the technique in the sourcecode version, as well as building the binary on request.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Tue Apr 25, 2023 5:15 pm
by Christopher
Hello Kris,
Christopher wrote:
Tue Apr 25, 2023 3:52 pm
What we can offer you, if you're interested, is a compilation of this assembly; this technique allows you to use the same Json serialization across both net48 and net60.
Just in case you're interested, I've done a build which you can download from here. This contains TeeChart.WinForm.dll for both net6.0 and net48, and a demo app which loads Chart2.ten—created from a net6.0 app—into a net48 Windows Forms app.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Tue Apr 25, 2023 7:50 pm
by 16095093
Hi Christopher,

I've forwarded your responses to my manager. After reviewing what you said, we request the source code for two main reasons. We'll need to downgrade the System.Text.Json version to avoid the issue we are seeing with ArcGIS Pro 3. And we'll need to make sure our custom save behavior for the export button is implemented.

For clarification - will we be able to read the old net472 settings? If we can do that and then persist in json in both net472 and net6 going forward (which it sounds like we can), this is definitely the direction we want to go in.

Just let me know when you've posted the source code and I'll login and download it.

We really appreciate you taking a deeper look into this issue for us and providing with what we hope is a good solution going forward.

Regards,

Kris Culin
Bentley Systems, Inc.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Wed Apr 26, 2023 7:47 am
by Christopher
Hello Kris,
Kris C wrote:
Tue Apr 25, 2023 7:50 pm
For clarification - will we be able to read the old net472 settings? If we can do that and then persist in json in both net472 and net6 going forward (which it sounds like we can), this is definitely the direction we want to go in.
You will be able to read the binary-formatted template files using the TeeChart assemblies which have not deprecated BinaryFormatter. All of the TeeChart components which wrap the netstandard2.0 TeeChart.dll do not and will never support BinaryFormatter, and these include:
1. TeeChart.Server.dll (net6.0)
2. TeeChart.WPF.dll (net6.0)
3. TeeChart.WinForm.dll (net6.0)
4. TeeChart.WinForm.dll (net48) - this is the assembly I sent to you for testing yesterday

The TeeChart assemblies which do and will always support BinaryFormatter are:
1. TeeChart.dll (net40)
2. TeeChart.WPF.dll (net40)

These two assemblies do not wrap the netstandard2.0 TeeChart.dll, as the TeeChart.dll here is a stand-alone assembly which supports Windows Forms in >= net40.

The Json template format is universal to the four assemblies which wrap the netstandard2.0 TeeChart.dll, whereas the binary-formatted template files is not universal to the two assemblies which support it—the binary-formatted template file produced by TeeChart.dll cannot be used by TeeChart.WPF.dll, and vice-versa. The assemblies which do not support BinaryFormatter do not and will not be able to read the binary-formatted template files, as enabling them to read those files would mean implementing BinaryFormatter, a class which has been deprecated by Microsoft itself as an irreparable security risk.

I hope this rather lengthy reply answers your question and explains the reasoning behind our decisions.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Wed Apr 26, 2023 9:05 am
by 16095093
Thank you for the clarification. That information is very helpful.

Let me know where to get the source code for the modifications you made, and we can get started on our end with the needed changes.

Again, we appreciate the lengths in which you are assisting us with this issue.

Regards,

Kris Culin
Bentley Systems, Inc.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Thu Apr 27, 2023 6:44 pm
by 16095093
Hi Christopher,

Just checking to see when we can get the modified code as you described. We need to schedule the work on our end so the sooner we can get it, the sooner we can start on it.

Thanks,

Kris Culin
Bentley Systems, Inc.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Fri Apr 28, 2023 9:13 am
by Christopher
Hello Kris,

we're going to have to do a special source-code build specially for you, as we still have a number of problems with the System.Text.Json NuGet when referencing a netstandard2.0 project from net48, both using v7.0.0.0 and v.6.0.0.0.

I'm working on this special build for you now, and will let you know when you can download it.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Fri Apr 28, 2023 9:21 am
by 16095093
Thank you for the update, Christopher.

Can you target net472 instead of net48? We need to target net472 and net6. We have no choice on net472.

Since this will be a special source configuration for us, could you just reference System.Text.Json 6.0.0? We'll need to downgrade anyway so it is compatible with ArcGIS Pro 3.

Again, we really appreciate the work you are doing on this.

Regards,

Kris Culin
Bentley Systems, Inc.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Fri Apr 28, 2023 10:37 am
by Christopher
Hello Kris,

You can download the new source-code version from here:
https://steema.com/files/public/support ... 3.2.28.zip

This is a simple zip file, instead of an installer, and the password is the first 12 characters of the TeeChart.licenses file you posted to our server in the file named TeeChartNET6LicenseIssue.zip.

I think I've made all the changes you asked for; please let us know if there's anything else we can do.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Fri Apr 28, 2023 10:48 am
by 16095093
Thank you so much Christopher. We really, really appreciate it.

I will let you know if there is anything else. I'll get started on the changes on our end.

Kind Regards,

Kris Culin
Bentley Systems, Inc.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Thu May 11, 2023 4:01 pm
by 16095093
Hi Christopher,

I wanted to let you know that we got things working on our end. It was a bit complicated to get going (primarily due to our code configuration) but it is working to our satisfaction.

Thank you again so much for the time you spent with us to figure things out. It is greatly, greatly appreciated.

Kind Regards,

Kris Culin
Bentley Systems, Inc.

Re: net6 and net4 (winform) and handling of chart settings

Posted: Thu May 11, 2023 4:12 pm
by Christopher
Hello Kris,
Kris C wrote:
Thu May 11, 2023 4:01 pm
Thank you again so much for the time you spent with us to figure things out. It is greatly, greatly appreciated.
We are very pleased to read this, and we would also like to thank you very much for taking the time to pass this message on. If there's anything else we can do, please don't hesitate to let us know.