Free Support Forum -

setLicense() - System.NullReferenceException

Hi there,

we sometimes get the following error:
System.NullReferenceException: Object reference not set to an instance of an object. at x28925c9b27b37a46.x220f433da4115056.x7d0214bf69711dd9(Stream xcf18e5243f8d5fd3) at x28925c9b27b37a46.x220f433da4115056.x7d0214bf69711dd9(String x1c1fc72fe1a3b4ea, Assembly x5807f920b6fc67c4) at Aspose.Words.License.SetLicense(String licenseName)

We are running Aspose.Words in a webservice context. Do you have any expirience with loading the license glabally in a webservice?



Thanks for your request. The problem might occur because you are setting the license multiple times in multiple threads. The older versions of Aspose.Words have a problem with such scenario. The problem was fixed few releases ago so now it is safe to set license in multiple threads. However, it is still not recommended. It is better to set license only once per application domain as described in the documentation:

Best regards,

Static constructor looks good.