Free Support Forum - aspose.com

SetLicense / Object reference not set to an instance of an object

Hi,

With Aspose.PDF 17.4.0 the following error occours:
Object reference not set to an instance of an object.

Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(“Aspose.Total.lic”);

Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Source: Aspose.Pdf
TargetSite: Void (System.IO.Stream)
StackTrace:
bei _ .
(Stream )
bei _ .
(String _, Assembly _)
bei Aspose.Pdf.License.SetLicense(String licenseName)

What’s the resason for this? With v17.2.0 it works without problems.

Regards,
Heiko

Hi Heiko,


Thanks for contacting support.

From your above description, it appears that you have started facing issue while setting up license with latest release and the same license with same code base base been working with earlier release of Aspose.Pdf for .NET 17.2.0. Can you please share the license file by following the instructions specified over How to send a license?

Also please share the code snippet which you are using to initialize the license. We will test the scenario and will keep you updated with our findings. We are sorry for this inconvenience.

Hi Nayyer,

I’ve sent a code snippet and the license file via e-mail.

Regards,
Heiko

Hi Heiko,


Thanks for sharing the license file.

I have tested the shared license with latest release of Aspose.Pdf for .NET 17.4.0 in VisualStudio 2015 application running over Windows 10(x64) with regional language as US-English and I am unable to notice any issue. As per my observations, the license is properly being applied. Can you please try using the latest release and in case the issue still persists, please share a sample project and details regarding your working environment, so that we can further look into this matter. We are sorry for your inconvenience.

Hi Nayyer,

With a (new) sample project everything is fine.
We will wait for version 17.5.0 and try again.

Regards,
Heiko

Hi Heiko,


Thanks for contacting support.

We are glad to hear that your problem is resolved. Please continue using our API and in the event of any further query, please feel free to contact.

Furthermore, the new release of Aspose.Pdf for .NET 17.5.0 is scheduled to release in early May-2017.

Hi,

We have encountered a similar issue and I thought I would continue this thread. Please let me know if I should start a new one.

We are on Aspose.PDF version 17.2 and one of our servers throws the following errors intermittently. Other servers and other environments do not have this issue. With our POC applicaitons using the license too, this error isn’t present.

System.NullReferenceException: Object reference not set to an instance of an object. at _ ._(Stream _) at _ ._(String _, Assembly _) at Aspose.Pdf.License.SetLicense(String licenseName) at ....AsposeLicenseManager.SetLicense() in ...\Common\AsposeLicenseManager.cs:line 48 at ...

Helko mentioned this error occured with 17.4 and did not occur with 17.2. We see this similar error with 17.2.

The code we have for setting license:

    string LicensePath = asposeSection?["LicensePath"];
...
    public  bool SetLicense()
    {
        if (!IsLicenseAvailable)
        {
            // TODO: write a log message 
            return false;
        }

        new Aspose.Pdf.License().SetLicense(LicensePath);
        new Aspose.Cells.License().SetLicense(LicensePath);
        new Aspose.Words.License().SetLicense(LicensePath);

        return true;
    }

Please advise.

Thanks,
Praveen

@koosala4,
Kindly send us your license file through a private message. We will investigate and share our findings with you.

@koosala4,
Thank you for sending the license file. We have tested your license file with the latest versions of Aspose.Cells, Aspose.Words and Aspose.Pdf APIs. We are unable to replicate this error in our environment. Kindly create a small project application which reproduces this error in your environment, and then send us a Zip of this project. Please also share details of the problematic environment, including Operating System (name & edition), local language settings and some handy information which could help us to replicate this error in our environment. Your response is awaited.

This problem is open in many threads and there is nowhere an answer to it. We have this problem also on our side. It happens some times but not always. I could replicate the problem by closing the whole visual studio and starting it again. After doing that the problem arises the first time

@stanlife

Thanks for contacting support.

We had noticed such issue in the past and it was resolved in latest version of the API. Would you please make sure to use latest version of the Aspose APIs and in case you still face any issue, please share with which specific API issue is occurring. It would also be helpful if you can please share a sample application along with the details of steps for reproducing the issue. We will test the scenario in our environment and address it accordingly.

Is there any workaround for former versions? It is not possible for us right now to go to the latest version.

@stanlife

Would you please confirm the API with which you are facing this issue and which version are you using at your side.

It happens when I use this line of code:
licensePdf.SetLicense(“MyNamespace.DocumentGeneration.Aspose.Pdf.lic”)
and I am using Aspose version 17.1.0.0.
Thanks

@stanlife

I am afraid that you are using quite old version of the API. However, you may please try changing routine of setting your license according to details given over following link:

We hope this may help resolving your issue. In case issue still persists, please let us know by sharing a sample application. We will further proceed to help you out.