license error "object reference not set"

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
GordonLindsay
Newbie
Newbie
Posts: 5
Joined: Fri Nov 15, 2002 12:00 am
Location: Melbourne, AUS
Contact:

license error "object reference not set"

Post by GordonLindsay » Wed Jun 29, 2005 12:05 am

Hi,

After upgrading an app to TChart version 1.1.2004.16592 and following tutorial 17, I added a chart to a form and deleted it. The licenses.licx file appeared as an Embedded Resource in the dll project, it's contents:
Steema.TeeChart.TChart, TeeChart, Version=1.1.2004.16592, Culture=neutral, PublicKeyToken=9c8126276c77bdb7
I then compiled the project and installed on a clean test system and when I run the app I get an error (no problems on the build system):
System.NullReferenceException: Object reference not set to an instance of an object.
at Steema.TeeChart.FrAccessProvider.GetLicense(LicenseContext context, Type type, Object instance, Boolean allowExceptions)
at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey)
at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license)
at System.ComponentModel.LicenseManager.Validate(Type type, Object instance)
at Steema.TeeChart.Chart..ctor()
at Steema.TeeChart.TChart..ctor()
Any Clues?
Regards
Gordon Lindsay

GordonLindsay
Newbie
Newbie
Posts: 5
Joined: Fri Nov 15, 2002 12:00 am
Location: Melbourne, AUS
Contact:

Problem Solved!

Post by GordonLindsay » Wed Jun 29, 2005 12:13 am

I solved my problem, hopefully this will help anybody else with the same problem.

The "object ref not set" exception (or bug?) occurs when the Tchart license file is included in a dll assembly and not in an exe asm. The Tchart license manager must only check the executing assembly (.exe) and if the license file is not there you get this error, even if it is included in the .dll referenced by the exe asm.

Hopefully this will be fixed in a new version (by checking the current asm and not just the executing), but here's the work around: simply copy the licenses.licx file into the executable assembly (even if it does not reference tchart directly) and re-compile.

This should have been mentioned clearly in Tutorial 17, if steema was aware of it?
Regards
Gordon Lindsay

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jun 29, 2005 11:34 am

Hi Gordon,

Thanks for your report. Yes, this is a known issue. Sorry for not having advised. However it is already included in TeeChart for .NET v2 tutorials but not in v1 ones.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

mweaver
Newbie
Newbie
Posts: 10
Joined: Tue Apr 08, 2003 4:00 am

Steema.TeeChart.FrAccessProvider.GetLicense

Post by mweaver » Fri Sep 23, 2005 4:25 pm

Is it true that the issue described in this post applies only to the most recent version (1.1.2004.16592)?

We did not have this problem with 1.1.1769.19457, but after upgrading, we are having this problem.

One of our modules that uses TeeChart is distributed as a DLL that is hosted in a third-party application. Since we are not the manufacturer/vendor of the third-party application, we have absolutely no control over the executable (*.exe) - so we cannot embed the license file in the executable (its not even a .NET application, we use COM interop to utilize our .NET DLL). We can embed the license file in our DLL, but that doesn't seem to work (as described in the previous post).

Any suggestions?

Or are we forced to downgrade to the previous version of TeeChart? :?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Sep 26, 2005 9:05 am

Hi mweaver,

There is also a licensing aspect that came to light that we weren't aware of in time for the documentation and that may help to know.

The issue relates to applications that compile TeeChart into a DLL that is then used in turn by a different application. Please note the comments from a TeeChart Developer who ran through runtime licensing steps:

"...
It was not enough to provide
the .licx entry in building the DLL that instantiates and uses TeeChart -
no! In fact, even though the main project (the EXE module) did not
reference TeeChart, apparently it was necessary to add the TeeChart
licensing entry to this project's own .licx file
..."

Please check that the point might not apply in your case. If that's not relevant or of help and the test below doesn't help either, please let us know what type of application TeeChart is being built into along with any other information you might feel is of use and we'll look for other causes of the problem.

Another test (assuming your application doesn't fall into the dll type described above), would be to recompile the TeeChart demo (assuming you ran the precompiled exe?) on your development machine and then test that on the runtime machine. That would confirm that the designtime license is correctly in place on your development machine and able to correctly 'compile-in' the license.

Please let us know if the above doesn't help resolve the issue.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

mweaver
Newbie
Newbie
Posts: 10
Joined: Tue Apr 08, 2003 4:00 am

Post by mweaver » Mon Sep 26, 2005 4:24 pm

What you said:

"...
It was not enough to provide
the .licx entry in building the DLL that instantiates and uses TeeChart -
no! In fact, even though the main project (the EXE module) did not
reference TeeChart, apparently it was necessary to add the TeeChart
licensing entry to this project's own .licx file
..."

exactly describes the problem I'm having. Our DLL is hosted inside another third-party application (that is not even a .NET application). This third-party application dynamically loads a COM (VB6) dll that is written by us, which then calls a .NET dll (written by us) that instantiates TeeChart. We can (and have) included the TeeChart .licx in our .NET dll. However, as your quote above describes, this still does not work because the executable does not contain the TeeChart .licx. Since the executable comes from a different vendor, we cannot include the TeeChart .licx in the executable.

What confuses me is that we did not have this problem with v1.1.1769.19457, the error only started occuring when we upgraded to v1.1.2004.16592. So something must have changed within TeeChart that causes this problem.

Ideally, we would like to use the current version (1.1.2004.16592) but we cannot do so if this licensing issue is not resolved.

Marc
Site Admin
Site Admin
Posts: 1217
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Tue Sep 27, 2005 10:52 am

Hello,

Hmmm .... a complicated licensing challenge. The intention of the TeeChart Designtime license is to invoke the requirement of a Designtime license at the place where TeeChart is compiled in a designtime environment. In that respect it is working correctly as your customer is using TeeChart in a designtime environment due to its inclusion in your designtime DLL. Under conventional circumstances that client would need a TeeChart Developer License.

If we assume that your DLL does not publish any access to the TeeChart API, that being that no TeeChart properties or influence on Chart characteristics may be modified by your customer then we could interpret that the TeeChart environment offered to your customer is closed and the customer does not require a TeeChart Developer License.

That being the case we need to run some tests here to see whether we can find a solution for this application topology within the Licensing framework offered by Microsoft and used by TeeChart. We'll get back to this thread with proposals.

Re. differences v1.1.1769.19457 and v1.1.2004.16592.
Earlier releases of teeChart for .NET did not include a coded license control. Most likely for that reason you didn't come across this issue before.

Regards,
Marc Meumann

Marc
Site Admin
Site Admin
Posts: 1217
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Tue Sep 27, 2005 3:09 pm

Hello,

A question.
What .NET language are you using for development? If you are using VC++ and exporting dll functions the issues may relate to those touched on in this post:

http://www.teechart.net/support/modules ... 209bcec808

Please tell us any more information that may help us to as near as possible reproduce your test setup.

With thanks.
Regards,
Marc Meumann
Steema Support

Marc
Site Admin
Site Admin
Posts: 1217
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Tue Sep 27, 2005 4:25 pm

Hello,

We've tested a copy of the configuration as described.

Summary of steps taken:
1. Create C# Class Library project and reference TeeChart. Manually add a Licenses.licx file to the project as an embedded resource (can add copy from TeeChart example demo folder). Add a few methods/properties to the Class. For test Class creates Chart on Load. Set 'Register Chart as Interop compatible' option and build project (This on machine with Developer License installed).

2. Create VB6 ActiveX DLL, add project created in step 1 (.tlb) as reference. add dll functionality. For test purposes we added a property to modify the Chart Title though this kind of access would require a TeeChart Developer License at each installation if implemented. Build project.

3. Move DLLs prepared in steps 1 and 2 to machine without TeeChart Developer License. Create standard desktop executable in VB6 and reference DLL created in step 2. Add functionality and access methods of that DLL. Build project. Application here functioned correctly when tested.

If your development environment for step 1 is VC++ please follow the steps described in the thread linked from the previous post in this thread. If any issue remains outstanding please let us know.

Regards,
Marc Meumann
Steema Support

mweaver
Newbie
Newbie
Posts: 10
Joined: Tue Apr 08, 2003 4:00 am

Post by mweaver » Tue Sep 27, 2005 8:01 pm

We are using VB.NET (not VC++). I have created a simple test project and I am still getting the same license exception. Please download:

http://support.earthsoft.com/products/T ... icense.zip

The solution consists of two projects:

- TeeChartDLL: a VB.NET class library consisting of one form that contains a TeeChart. This assembly does contain the .licx file with the TeeChart license info. You can use ILDASM to see the licenses are included in the manifest.

- VBNET: a VB.NET windows application that shows the form defined in TeeChartDLL. This project does NOT include any .licx file. You can use ILDASM to check the assembly and see that no license are included.

When I run VBNET.exe on my development machine, everything works fine. Next I copy the files (VBNET.exe, TeeChartDLL.dll, TeeChart.dll) onto a clean Windows XP Pro machine (that has no development license). When I run VBNET.exe on the clean machine, I get the licensing exception.

What am I doing wrong?

Terry
Newbie
Newbie
Posts: 9
Joined: Wed Jun 22, 2005 4:00 am
Location: California

Same issue in C#.

Post by Terry » Tue Sep 27, 2005 10:42 pm

Hello,

I am having the same issue with a different configuration and for a different reason. I am working on a large project with close to 20 developers. Only a few of us develop charts with TeeChart for the application. We have separated the visualization development out in it's own DLL so we would only have to buy TeeChart licenses for those doing development with TeeChart. Now, those developers not doing TeeChart development can't see charts at all.

My configuration for this part of the project is completely C#.

I understand you are trying to protect revenue stream from people just wrapping TeeChart with one development license and using all over, but if we are forced to buy licenses we don't use for development we will have to rethink what to use.

Terry

Marc
Site Admin
Site Admin
Posts: 1217
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Wed Sep 28, 2005 7:40 am

Hello Terry,

With respect to the configuration you describe, if members of your developer team needs to compile a group-work project containing TeeChart without actually coding with TeeChart itself I recommend that you download the developer license installer utility to install the physical Developer License in each developer's PC thus permitting compilation. We understand that under these circumstances that is a practical option and doesn't imply the need for the purchase of a Developer License for those team members not coding with TeeChart.

With regards to the penultimate post, we'll take a look at the sample project and get back with comments.

Regards,
Marc Meumann
Steema Support

Marc
Site Admin
Site Admin
Posts: 1217
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Wed Sep 28, 2005 8:18 am

Hello,

With respect to the sample included a couple of posts ago, TeeChartLicense.zip. The setup is slightly different to the one we tested earlier in the thread. We set it up for a closer look. In this particular case, because the final development project is a .NET project, not VB6, then the licenses.licx file must be added to the project. After being added it compiled and worked correctly when tested here as a runtime application.

If you want to confirm that the compilation is actually 'compiling-in' the license then a quick test is to go to the following registry key and modify its contents:
ie. Key
[HKEY_LOCAL_MACHINE\SOFTWARE\Steema Software\TeeChart.NET]
"DesignKey"="Steema.TeeChart.TChart is a licensed component."
Modify to:
"DesignKey"="xxSteema.TeeChart.TChart is a licensed component."
(Please note that for TeeChart for .NET version 2 the key is called "DesignKeyV2")

If you then rebuild your solution it should generate the following error (twice in the case of this test as it tries to build-in the license to the TeeChartDLL and the VBNET projects of the solution).
'path'\licenses.licx Could not transform licenses file 'licenses.licx' into a binary resource. (1) : error LC0004 : Exception occured creating type 'System.ComponentModel.LicenseException'
If the build doesn't generate the error then the version of TeeChart pathed from Visual Studio is most likely not the correct one.

When all confirmed, put the key contents back to its original state to continue.

Regards,
Marc Meumann

mweaver
Newbie
Newbie
Posts: 10
Joined: Tue Apr 08, 2003 4:00 am

Post by mweaver » Wed Sep 28, 2005 2:06 pm

OK, thank you for your help. The example code I posted was another scenario we have that was causing the same problem. But by including the .licx in the .NET executable, the problem is resolved. We also have the issue of the COM executable, but as you illustrated, the exception doesn't occur if the .licx is compiled into the .NET library. Thanks again for your help.

Terry
Newbie
Newbie
Posts: 9
Joined: Wed Jun 22, 2005 4:00 am
Location: California

Where to get license installer.

Post by Terry » Wed Sep 28, 2005 3:20 pm

I feel dense, but I could not find the "development license installer" to download. Could you give me a pointer?

Terry

Post Reply