Getting null pointer for Aspose.Words.License

We’ve been using an older version of Aspose.Words .Net, and a few days ago upgraded to 6.1.0. We are now(sometimes) getting a null pointer exception when trying to instantiate an Aspose.Words.License object. This does not always happen(and didn’t happen before the Aspose update).

I don’t see this problem in the QA environment, but I see it sometimes in the Production website. We have a scheduled task that runs daily, and it looks like it instantiates an Aspose.Words.License object and calls SetLicense() many times(hundreds perhaps?) per App Domain - which is contrary to your instructions. I see the log littered with null pointer exceptions. And today, we got the same exception from the website. Is there a chance that instantiang and calling SetLicense() so many times is causing a problem?

Thanks for your request. It is difficult to say what the reason of the problem is. Could you please provide me stack trace of exception?
Best regards.

Sure, here’s a stack trace(not much there):

at հ.ᖍ.ᖝ(Stream Ԏ)
at հ.ᖍ.ᖝ(String ᖞ, Assembly ᖟ)
at Aspose.Words.License.SetLicense(String licenseName)
at icrunchdata.Site.Job.get_JobHtml()

Here’s the Exception.Message that goes along with it:

Object reference not set to an instance of an object.

Here our code that sets the license:
Aspose.Words.License license = new Aspose.Words.License();

Note, if I delete and re-add the following files from the website /bin folder the problem clears up, but then comes back 1.5 hours later(at least today). :
Aspose.Words.xml (our dll that calls the Aspose dll)


Thank you for more information. This is really odd. I cannot reproduce this problem on my side. Maybe you should try calling SetLicense on ApplicationStart as described here:
Best regards.

I changed the code to call SetLicense() once, as recommended, and things are much better now. Thanks.