Licensing with .NET 6 App

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Kris C
Newbie
Newbie
Posts: 59
Joined: Fri Jan 13, 2023 12:00 am

Licensing with .NET 6 App

Post by Kris C » Thu Mar 16, 2023 1:46 pm

Hello,
I've found other postings about licensing with .NET6 but I wanted to post my own question about it.

Due to how our code base is configured and the fact that we run within multiple platforms (programs that we do not deploy and therefore cannot embed the file into), embedding the licenses file does not work for us. We have therefore used the approach of having it in the output file next to the TeeChart.dll.

This works for net472.

It does NOT work for net6.0-windows. I confirmed that the TeeChart.Licenses file is next to the TeeChart.dll and TeeChart.WinForm.dll in the output file when building net6.0-windows. But at runtime, we still get the watermark.

What is the missing step to get this working properly in .net6?

Thanks,

Kris Culin

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

Re: Licensing with .NET 6 App

Post by Christopher » Fri Mar 17, 2023 8:54 am

Hello Kris,

I've just run a test using this specific NuGet:
https://www.nuget.org/packages/Steema.T ... .2023.3.13

Running this in a WinExe project in framework net6.0-windows with the TeeChart.licenses set to Copy always:
Screenshot from 2023-03-17 09-45-20.png
Screenshot from 2023-03-17 09-45-20.png (11.2 KiB) Viewed 20814 times
Produces a Chart without a watermark. So we now have to discover what is different about your set up. Which NuGet package are you using? Is your TeeChart.licenses set to 'Copy always' (you could try this in a simple test project to be sure)? Do you have a valid license for TeeChart for .NET 6.0? You can check this latter question by visiting:
https://www.steema.com/linkIn/License_information_check

And pasting in the content of your TeeChart.licenses file—one of the 'Assembly name' should contain 'teechart.winform', and the version of NuGet you are using should be of a datetime anterior to the license expiry date.

If you are still experiencing problems, could you please send your TeeChart.licenses file in an email to sales@steema.com and we will check the issue here using it.
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

Kris C
Newbie
Newbie
Posts: 59
Joined: Fri Jan 13, 2023 12:00 am

Re: Licensing with .NET 6 App

Post by Kris C » Fri Mar 17, 2023 6:40 pm

Hi Christopher,

Shouldn't the licenses file work for both net472 and net6 TeeChart assemblies? it does work for net472. It's in the output folder for the net472 build. It's there for the net6.0-windows build. But the watermark *shows* for the latter.

I used the license verifier and teechart and teechart.winform are both listed.

Unfortunately, we cannot use the NuGet package. This is because we need to add some custom behavior for the export button to allow our users to save files to a specialized location. There is no hook for me to use otherwise. This means we have to build the assemblies and reference them directly.

We use a condition on the reference to TeeChart.WinForm.dll so it is only "used" if the target framework is net6.0-windows.

Could we possibly embed the licenses file into the TeeChart or TeeChart.dll file when we build it?

Kris

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

Re: Licensing with .NET 6 App

Post by Christopher » Mon Mar 20, 2023 10:27 am

Hello Kris,

we really need to be able to reproduce this issue here to see if we can fix it. If I remove the NuGet package from my test project and try to add in the TeeChart.WinForm.dll directly, Visual Studio v.17.5.2 gives me an error message:
Screenshot from 2023-03-20 11-24-16.png
Screenshot from 2023-03-20 11-24-16.png (87.76 KiB) Viewed 20787 times
The log tells me:

Code: Select all

=====================
20/03/2023 11:23:44
Recoverable
Microsoft.Build.Exceptions.BuildAbortedException: MSB4188: Build was canceled.
===================
I'm not sure what's going on here, but it does mean I cannot try to reproduce your issue by running a Windows Form .NET 6.0 project without referencing the NuGet file.

What we would be looking for from you, if possible, is a Short, Self Contained, Correct (Compilable), Example—if we can reproduce the problem here we can evaluate possible strategies to mitigate the issue.
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

Kris C
Newbie
Newbie
Posts: 59
Joined: Fri Jan 13, 2023 12:00 am

Re: Licensing with .NET 6 App

Post by Kris C » Fri Apr 07, 2023 2:27 pm

Hi Christopher,

Sorry for the delayed response. I never got an email about your posted response.

If you edit the project file and check to see what the order is for "TargetFrameworks" and have net6.0-windows listed first, it should allow you to select the TeeChart.WinForm.dll reference. If net472 is listed first, then it expects you select a net472 reference. It's an annoying Visual Studio issue that I've noticed.

I'll see if I can create a small project that reproduces the issue that uses the direct reference. Hopefully I can upload as the upload size is extremely small.

Kris

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

Re: Licensing with .NET 6 App

Post by Christopher » Tue Apr 11, 2023 9:17 am

Hello Kris,
Kris C wrote:
Fri Apr 07, 2023 2:27 pm
Sorry for the delayed response. I never got an email about your posted response.
Sorry about that, I'll have to check that system.
Kris C wrote:
Fri Apr 07, 2023 2:27 pm
I'll see if I can create a small project that reproduces the issue that uses the direct reference. Hopefully I can upload as the upload size is extremely small.
That would be great. Just to let you know we have a service https://steema.cat/uploads/ which enables you to leave a file on our server in a folder with the same name as your email address, if you were to need it.
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

Kris C
Newbie
Newbie
Posts: 59
Joined: Fri Jan 13, 2023 12:00 am

Re: Licensing with .NET 6 App

Post by Kris C » Thu Apr 13, 2023 11:46 am

Hi Christopher,
I've attached a very simple project that is multitargeted between net472 and net6.0-windows.

The licenses file is included in the project and is set to copy if newer into the output folder so it will be there when you build and run.

If you set the target framework to net472 the watermark is not present. However, when you build and run in net6, the watermark is there even though the licenses file is there as well. This is the problem we are running into.

Using your upload service, I uploaded the file TeeChartNET6LicenseIssue.zip under kris.culin@bentley.com.

Because the project is multitargeted, you can select which target framework to use when running. Just be sure you select the net6 to see the issue.

Kris

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

Re: Licensing with .NET 6 App

Post by Christopher » Thu Apr 13, 2023 3:28 pm

Hello Kris,

thanks for that.

I've got it working by copying across a few assembly to the Refs folder and modifying the <References> like this:

Code: Select all

        <Reference Include="PdfSharpCore" Condition="'$(TargetFramework)'=='net6.0-windows'">
          <HintPath>..\Refs\net6.0-windows\PdfSharpCore.dll</HintPath>
          <Private>True</Private>
        </Reference>
        <Reference Include="SixLabors.Fonts" Condition="'$(TargetFramework)'=='net6.0-windows'">
          <HintPath>..\Refs\net6.0-windows\SixLabors.Fonts.dll</HintPath>
          <Private>True</Private>
        </Reference>
        <Reference Include="SixLabors.ImageSharp" Condition="'$(TargetFramework)'=='net6.0-windows'">
          <HintPath>..\Refs\net6.0-windows\SixLabors.ImageSharp.dll</HintPath>
          <Private>True</Private>
        </Reference>
        <Reference Include="TeeChart">
          <HintPath>..\Refs\$(TargetFramework)\TeeChart.dll</HintPath>
          <Private>True</Private>
        </Reference>
        <Reference Include="TeeChart.WinForm" Condition="'$(TargetFramework)'=='net6.0-windows'">
          <HintPath>..\Refs\net6.0-windows\TeeChart.WinForm.dll</HintPath>
          <Private>True</Private>
        </Reference>
I build in Release mode and then run the two resulting executables, and they both have the watermark removed.

The reason we need the SixLabors assemblies is because the PdfSharpCore NuGet depends on them, although curiously it seems the SharpZipLib is not necessary for the TChart to render. I obtained these assemblies by deleting all the above references and adding in our NuGet; when we build in Release mode we can see these assemblies in the net6.0-windows folder, and it's then a case of copying them across to the Refs folder.
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

Kris C
Newbie
Newbie
Posts: 59
Joined: Fri Jan 13, 2023 12:00 am

Re: Licensing with .NET 6 App

Post by Kris C » Thu Apr 13, 2023 7:20 pm

Thank you Christopher! I will get a copy of these assemblies and add them to our source control so they can be included in the build and deployment.

As I mentioned before, we need to build from your source code because we need special behavior with the Export button. Should I just make a post for a feature request regarding this? If I can get a hook to provide my custom behavior instead of having to modify the source code, then we'd be able to use the NuGet package.

Again, many thanks.

Kris

p.s. I had this thread marked with the "notify me when a reply is posted" option but I never received an email. Nothing in junk mail folder either.

Kris C
Newbie
Newbie
Posts: 59
Joined: Fri Jan 13, 2023 12:00 am

Re: Licensing with .NET 6 App

Post by Kris C » Thu Apr 13, 2023 10:03 pm

Hi Christopher,

I tried adding the missing assemblies to the output folder when we build but the licensing is still not being applied. The watermark remains. I verified that all the assemblies you have listed are in the output folder along with the TeeChart.licenses file.

This ONLY happens if we use the built assemblies from the TeeChart source code. if I use the NuGet package from 12/1/2022, then the licensing works correctly in net6.

You state that you got it to work by adding the assemblies to the refs folder. Can you send me the copy of the assemblies you used? I grabbed them from the corresponding NuGet packages and AFIK I used the correct version and tfm. Even when I build with the NuGet package in the same project, the supporting assemblies are not in the output folder and I'm not sure how to force that to happen.

if you can't send me the assemblies, can you verify which NuGet versions you are using and the TFM?

Kris

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

Re: Licensing with .NET 6 App

Post by Christopher » Fri Apr 14, 2023 7:55 am

Hello Kris,
Kris C wrote:
Thu Apr 13, 2023 10:03 pm
You state that you got it to work by adding the assemblies to the refs folder. Can you send me the copy of the assemblies you used?
Of course. Please find the assemblies in this TeeChartAreaProblem.zip. You will see two folders in this zip file, TeeChartAreaProblemNUGET and TeeChartAreaProblemREFS. If you open TeeChartAreaProblemNUGET, you will see it refers to the latest public NuGet package (4.2023.3.23 at time of writing); building this project in Release mode and then running the executable files works fine, as I think you already know. All I did then was to copy the relevant files from the net472 and net6.0-windows folders to the respective folders in the Refs folder of TeeChartAreaProblemREFS; again, building this project in Release mode and running the two executables works as expected.
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

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

Re: Licensing with .NET 6 App

Post by Christopher » Fri Apr 14, 2023 8:15 am

Hello Kris,
Kris C wrote:
Thu Apr 13, 2023 7:20 pm
As I mentioned before, we need to build from your source code because we need special behavior with the Export button. Should I just make a post for a feature request regarding this? If I can get a hook to provide my custom behavior instead of having to modify the source code, then we'd be able to use the NuGet package.
You can post your request here, as I've mentioned, or you can post it on our issue tracker. If you post your request here I'll make an entry in our issue tracker anyway, so really it's a case of what is easier for you.
Kris C wrote:
Thu Apr 13, 2023 7:20 pm
p.s. I had this thread marked with the "notify me when a reply is posted" option but I never received an email. Nothing in junk mail folder either.
Yes, I think you mentioned this earlier in this thread; when I can I will try to resolve the issue.
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

Kris C
Newbie
Newbie
Posts: 59
Joined: Fri Jan 13, 2023 12:00 am

Re: Licensing with .NET 6 App

Post by Kris C » Fri Apr 14, 2023 12:06 pm

Hi Christopher,

Two things.

First, my manager has approved, for now, the use of the NuGet package for referencing the net6 version. We will do the code modification at a later date. That alone should resolve the licensing issue.

The feature request.

In the chart options dialog, you can export to a specific image format. I need a way to provide my own Save dialog when this button is clicked. I would handle that event, for example, and the event arguments would pass back the full path and filename and the image format to use. Then you'd be able to use that information to do the export.

There are many different ways you could implement this. DevExpress XtraReports uses an ICommand where I can provide an implementation of an ICommand and provide that for a specific button in their UI. When that button is clicked, it would execute the command provided, in this case mine. Otherwise, it would use its own default command. The basic idea is to provide a hook so a custom code change by a user (i.e. me) is not required.

Thank you again for the assistance. It is very much appreciated.

Kris Culin
Bentley Systems, Inc.

Kris C
Newbie
Newbie
Posts: 59
Joined: Fri Jan 13, 2023 12:00 am

Re: Licensing with .NET 6 App

Post by Kris C » Sun Apr 16, 2023 3:46 pm

Hi Christpher,

I've been racking my brain literally all weekend trying to get the licensing to work even with the NuGet package. I went so far to replicate a simplified version of our application framework. Unfortunately, the licensing worked. it also works in the test project that I previously sent you. It just doesn't work in our application.

So, I took a different approach. I took our application starter project and modified it. Instead of starting our application, I create a form, add a LineChartControl - which is one of our user controls with a TChart control on it, and add it to the form. Then I use Application.Run to start the application with this form. I left all the existing references and NuGet packages in place. This was the only change I made.

When I do this, I get the following exception on startup:

System.Security.Cryptography.CryptographicException: 'No OID value matches this name.'

> System.Security.Cryptography.Encoding.dll!System.Security.Cryptography.Oid.FromFriendlyName(string friendlyName, System.Security.Cryptography.OidGroup group) Unknown
System.Security.Cryptography.Algorithms.dll!System.Security.Cryptography.CryptoConfig.MapNameToOID(string name) Unknown
System.Security.Cryptography.Csp.dll!Internal.NativeCrypto.CapiHelper.NameOrOidToHashAlgId(string nameOrOid = "2.16.840.1.101.3.4.2.1", System.Security.Cryptography.OidGroup oidGroup = HashAlgorithm) Unknown
System.Security.Cryptography.Csp.dll!Internal.NativeCrypto.CapiHelper.ObjToHashAlgId(object hashAlg) Unknown
System.Security.Cryptography.Csp.dll!System.Security.Cryptography.RSACryptoServiceProvider.VerifyData(byte[] buffer = {byte[800]}, object halg = "2.16.840.1.101.3.4.2.1", byte[] signature = {byte[256]}) Unknown
TeeChart.WinForm.dll!rrt.fgp(System.Xml.XmlReader bmz = "None", System.Type bna = {Name = "Chart" FullName = "Steema.TeeChart.Chart"}, object bnb = {Steema.TeeChart.TChart}) Unknown
TeeChart.WinForm.dll!Steema.TeeChart.TeeFileLicenseProvider.ajx(System.IO.Stream bmz = {System.IO.FileStream}, System.Type bna = {Name = "Chart" FullName = "Steema.TeeChart.Chart"}, object bnb = {Steema.TeeChart.TChart}) Unknown
TeeChart.WinForm.dll!Steema.TeeChart.TeeFileLicenseProvider.GetLicense(System.Type type = {Name = "Chart" FullName = "Steema.TeeChart.Chart"}, object instance = {Steema.TeeChart.TChart}) Unknown
TeeChart.dll!Steema.TeeChart.Chart.Chart(Steema.TeeChart.IChart parent = {Steema.TeeChart.TChart}, Steema.TeeChart.ILicenseProvider provider = {Steema.TeeChart.TeeFileLicenseProvider}) Unknown
TeeChart.WinForm.dll!Steema.TeeChart.TChart.TChart() Unknown
Haestad.Framework.Windows.Forms.Steema.dll!Haestad.Framework.Windows.Forms.Steema.Components.ChartControl.InitializeComponent() Line 762 C#
Haestad.Framework.Windows.Forms.Steema.dll!Haestad.Framework.Windows.Forms.Steema.Components.ChartControl.ChartControl() Line 451 C#
Haestad.Framework.Windows.Forms.Steema.dll!Haestad.Framework.Windows.Forms.Steema.Components.LineChartControl.LineChartControl() Line 90 C#
WaterGEMS.dll!Haestad.Idaho.Starter.Starter.Main(string[] args = {string[0]}) Line 40 C#

This exception did *not* occur with my test application. It only happens in the above-described approach. it seems like this exception should *not* be occurring at all which is why I'm reporting it.

I am hoping you can make heads or tails out of the call stack to figure out what is going on and why the licensing isn't working for us.

For the record, this is working perfectly fine with net472. It is only net6 that has the issue of the licensing not working.

Kris

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

Re: Licensing with .NET 6 App

Post by Christopher » Sun Apr 16, 2023 5:17 pm

Hello Kris,

just a quick one—a Google search for the error doesn't turn up much, but in the first result there's a reply which suggests that this is a first-chance exception, and not an unhandled exception, and that running without a debugger might help. Does it?
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