SetLicense sporadically fails with NullReferenceException

@czielin,

We can now run your web application in our environment and could not replicate the null pointer error. Please list down all steps to replicate this error and send us a snapshot of the error. Please also send us your license file through a private message. Your response is awaited.

Furthermore, you are using a Pdf class to generate the document, it is the legacy approach and we do not recommend it. Please try the following code:

[C#]

Document document = new Document();
document.Pages.Add();
document.Pages[1].Paragraphs.Add(new TextFragment("Some text there"));
document.Save("path to save file");

Please also upgrade the version 17.1.0 of Aspose.Pdf for .NET API to the latest version 17.10. The 17.1.0 is quite an old version.

This is an important step in reproducing the error. You must simultaneously execute multiple requests as the application is starting up. Meaning before any other requests have been issued to trigger the application startup code. In my testing I used Fiddler to issue several simultaneous requests. Is this what you have done?

The code to create the PDF document is not actually relevant. The error can be reproduced without it. The race condition that causes the error exists within the licensing code. I just added document creation to test that documents can still be created once I implemented a work around that got me past the licensing error. Though I appreciate the heads up on this. This may be another area where you might consider making your recommendations more clear to developers by marking the legacy classes as deprecated in the API.

@czielin,

We could not replicate this error in our environment with multiple requests. We have tried Fiddler to issue several simultaneous requests as follows: http://localhost.fiddler:53176/home/index

We have also reviewed system event logs and there is no such error. Kindly share all steps with Fiddler to replicate this error, including the helping snapshots.