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

Free Support Forum - aspose.com

Stream corruption when calling license twice

Because of the multithreaded nature of my application, which has to load Aspose dynamically when needed, I was loading the Aspose license into a stream that I then pass to the child threads which have to load the component. What I found is that the stream object apears to become corrupted if the same child thread has to load Aspose more than once.

The workaround I found is to pass a byte array of the child threads and create the memorystream in the child threads, there's never a problem. This approach works fine for me. If I had the option of loading Aspose just once in the child thread, this would never be a problem.

I've included an attachment to demonstrate the issue.

Hi Jim,

Thanks for your inquiry.

To get this to work you need to use the extra line of code below:

MemoryStream stream = new MemoryStream(bytes);

for (int i = 0; i < 2; i++)


stream.Seek(0, SeekOrigin.Begin);

ProcessPDFStream(stream, i);


Although please note, that it's a bit wasteful to be setting a license for every child thread. I believe you can just set the license once for your entire application domain instead. You can find further details on applying licenses here.