GetLicense throws NullReferenceException

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
liviuz
Newbie
Newbie
Posts: 13
Joined: Tue Apr 08, 2003 4:00 am

GetLicense throws NullReferenceException

Post by liviuz » Tue Oct 11, 2011 1:50 pm

Hi Support,

We have been using the TeeChart for .Net control successfully for many years. Recently though we are getting the following error:

Code: Select all

Exception: NullReferenceException
Message: Object reference not set to an instance of an object.
Stacktrace:
   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()
This error only seems to happen on a machine with Window 7 (x64) SP 1. We don't get the error on x86-bit machines or other x64-bit platforms. Do you know why this might be happening?

Any help will be very much appreciated.

Thanks,
Liviu Zaharia

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

Re: GetLicense throws NullReferenceException

Post by Narcís » Tue Oct 11, 2011 3:38 pm

Hi Liviu,

This is most likely the developer license is not correctly installed on that machine. Please read this thread on how to fix this.
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

liviuz
Newbie
Newbie
Posts: 13
Joined: Tue Apr 08, 2003 4:00 am

Re: GetLicense throws NullReferenceException

Post by liviuz » Tue Oct 11, 2011 3:51 pm

Hi Narcís,

Unfortunatelly is not that simple.

I don't think there's an issue with my developer license on the build machine. As I was saying in my original port, the same app installed on other machines work fine, there are no errors raised. We onlyget the reported error on a Win7 x64-bit SP1 machine!

By the way, my app is running in 32-bit mode on the x64 bit machine, could this be the issue?

Regards,
Liviu

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

Re: GetLicense throws NullReferenceException

Post by Narcís » Tue Oct 11, 2011 4:08 pm

Hi Liviu,
I don't think there's an issue with my developer license on the build machine. As I was saying in my original port, the same app installed on other machines work fine, there are no errors raised. We onlyget the reported error on a Win7 x64-bit SP1 machine!
Most likely the developer license failed to install in your x64 machine. Which TeeChart version are you using? You said you got it working in other 64-bit machines, can you please confirm that?
By the way, my app is running in 32-bit mode on the x64 bit machine, could this be the issue?
No, that shouldn't be the problem. In that case you should just do as you'd in a 32-bit machine.
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

liviuz
Newbie
Newbie
Posts: 13
Joined: Tue Apr 08, 2003 4:00 am

Re: GetLicense throws NullReferenceException

Post by liviuz » Tue Oct 11, 2011 4:31 pm

Hi Narcís,

My build machine is XP 32-bit and my app is built for AnyCPU.

Indeed, I've instaled my app on various x64 machines. In most cases, when we run our app as a 64-bit app on 64-bit machine the license works fine (no errors raised).

We have a scenario though when we need to run our app as a 32-bit app on a 64-bit machine. This is the scenario when we're getting the above error. Why would that happen?

Regards,
Liviu

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

Re: GetLicense throws NullReferenceException

Post by Narcís » Tue Oct 11, 2011 5:36 pm

Hi Liviu,
We have a scenario though when we need to run our app as a 32-bit app on a 64-bit machine. This is the scenario when we're getting the above error. Why would that happen?
If the application is compiled using "Any CPU" in a 32-bit machine it sould be compiled in x86 mode so it should run in 32-bit mode on all machines. I don't see why should this occur. Could you please let us know the exact TeeChart version you are using and attach a simple example project we can run "as-is" to reproduce the problem here?

Thanks in advance.
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

liviuz
Newbie
Newbie
Posts: 13
Joined: Tue Apr 08, 2003 4:00 am

Re: GetLicense throws NullReferenceException

Post by liviuz » Wed Oct 12, 2011 1:56 pm

Hi Narcís,

We build our app for AnyCPU, but we have two builds for the main executable, one for AnyCPU and one for x86. When we need to start our app in 32-bit mode on a 64-bit machine we kick off the second executable (the one built for x86) and if my understanding is correct all the other components in our app will be running in 32-bit mode in this case.

The TeeChart is not referenced in the main executable, only in one of the components called from the main exe, therefore the component referencing TeeChart is built for AnyCPU.

As I was saying, the error only happens when our app is kicked off in 32-bit mode on a 64-bit machine. When we run our app on a 32-bit platform or on a 64-bit platform with the app running in 64-bit mode, the error isn't happening.

The version of TeeChart we're using is 1.1.2531.28391.

Regards,
Liviu

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

Re: GetLicense throws NullReferenceException

Post by Marc » Thu Oct 13, 2011 8:24 am

Hello Liviu,

The TeeReg utility, downloadable from the customer page (access here http://www.steema.com/clientaccess) registers TeeChart with x64 Windows, the original installer did not. Please try the utility, that may be the solution to the problem.

Regards,
Marc Meumann
Steema Support

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

Re: GetLicense throws NullReferenceException

Post by Marc » Thu Oct 13, 2011 8:42 am

Hello Liviu,

Sorry I didn't read the whole thread properly and had misunderstood that the problem occurs running the same executable on different machines [ok] ... and on the Win 7 x64 machine it fails. My suggestion with TeeReg most likely won't resolve your problem. We'll run a test here and I'll get back to this thread.

What version of Visual Studio NET are you using?

Regards,
Marc

liviuz
Newbie
Newbie
Posts: 13
Joined: Tue Apr 08, 2003 4:00 am

Re: GetLicense throws NullReferenceException

Post by liviuz » Thu Oct 13, 2011 8:57 am

Visual Studio 2010.

Liviu

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

Re: GetLicense throws NullReferenceException

Post by Marc » Thu Oct 13, 2011 11:17 am

Hello Liviu,

A basic forms application works correctly when tested here, compiled in a 32bit machine and run on Win7 (sp1) x64. I assume that works ok at your location too; if you're not sure you might like to drop a TeeChart onto a form and compile and run it on x64 Win7 to confirm it.

I can imagine licensing issues/error messages for TeeChart v1 if TeeChart forms part of an assembly that is called at runtime by an application that has no reference to TeeChart itself. But the problem would also be apparent on other platforms; the limitation is not, as far as I'm aware, in any way platform dependent. TeeChart makes a runtime license check, checking that the executing assembly, the assembly that initiates the execution-chain (via opening another assembly if necessary) that runs TeeChart has the TeeChart designtime license compiled into it at designtime. That would be the host assembly in this case. The Licenses.licx file requires to be present at that assembly level. If the assembly has no reference to TeeChart but does have the TeeChart licenses.licx entries then the compile will fail.

The problem may depend on how the assembly that houses TeeChart is being called. Are you sure that the other test machines you are using do not have the TeeChart designtime key installed? To confirm whether the designtime key exists see:
HKEY_LOCAL_MACHINE\SOFTWARE\Steema Software\TeeChart.NET:

"DesignKey"="Steema.TeeChart.TChart is a licensed component."
If the registry key is not present and the assembly-calling-assembly execution is running ok at runtime then please could you describe how your host assembly calls the assembly that houses TeeChart so that we can try to reproduce the format here to test.

With thanks.
Regards,
Marc

liviuz
Newbie
Newbie
Posts: 13
Joined: Tue Apr 08, 2003 4:00 am

Re: GetLicense throws NullReferenceException

Post by liviuz » Fri Oct 14, 2011 9:25 am

Hi Marc,

I think I narrowed this down to the way I'm building the 32-bit exe. If I build it using Visual Studio to target the x86 platform, the problem doesn't seem to happen. If instead I build it in VS for AnyCPU and then use the CorFlags.exe to change the bitness to 32-bit, that seems to create the issue.

Any idea why this might be happenning?

Regards,
Liviu

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

Re: GetLicense throws NullReferenceException

Post by Marc » Tue Oct 18, 2011 11:37 am

Hello Liviu,

We've not used Corflags here to post-modify a compiled assembly. I assume the utility change-affects some aspect of code area where the license is stored/read. Our recommendation would be to avoid using Corflags in this case if the other way of working is acceptable to you. We'll test it here and report the issue to Microsoft if we can't find a workaround.

Regards,
Marc
Steema Support

Post Reply