We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Is the License.SetLicense Method Thread Safe?

Is setting a license via the following call a thread safe?

var license = new Aspose.Slides.License();

license.SetLicense(licenseStream);

Will it break anything if I try to reset it to a valid license when the are other Aspose based components running on different threads (web app) and potentially using Aspose when I try to set a license?

@WorkZone,
Thank you for your question.

Unfortunately, I have not found any information about this. I logged the issue with ID SLIDESNET-42876 in our tracking system. We will reply to you as soon as possible.

@WorkZone,
Could you please describe a scenario in more detail of how and why you would like to reset licenses?

Our code does the license set with CLR module initializer feature.
Some customers from time to time have problems with “unlicensed watermark” on PDF.
It looks like the license is not set properly so the workaround for now would be setting the license in our code whenever we start using Aspose just before instead of having one initializer.
Obviously we would like to find and fix the original cause for not having this initializer properly called but until then we need to analyze different possibilities.

@WorkZone,
Thank you for the additional information.

Could you please clarify if you want to reset the license on the main thread only or on different threads?

The code that interacts with Aspose is used by web app, so different threads are involved.

@WorkZone,
I have passed your information to our developers. We will reply to you soon.

@WorkZone,
Our developers investigated the issue. The method License.SetLicense is not thread-safe, so synchronization primitives (like a lock) could be used to avoid issues.

Thank you @Andrey_Potapov