Technical question for Licensing

Hello,

during license activation, we get the following sporadic error from Aspose.Zip:

System.InvalidOperationException:
Failed to set license. Details: Der Thread wurde abgebrochen.
bei ?.(Object )
bei ?. (? , )
bei ?.()
bei ?. (Boolean )
bei ?.(Object )
bei ?.()
bei ?.(Object , UInt32 )
bei ?. (Boolean )
bei ?. (Boolean )
bei ?.()
bei ?.(Object[] , Type[] , Type[] , Object[] )
bei ?.(Stream , String , Object[] , Type[] , Type[] , Object[] )

We call the license activation from different parallel processes. I created a test application to check if parallel license activation is a problem, but i cannot reproduce this behavior.

Can you help me to find out what leads to this error?

Kind Regards,
Andy

Hello @AStelzner, yes, it seems like a multithreading issue. Please attach your sample, we’ll try to reproduce.
@denis.kudelin FYI.

It’s almost impossible to recreate this, because it’s very complex.
I can’t recreate it for me either, it’s only happening for our customer.
Some of the calls are COM and parallel too.

Are there any known restrictions?

@AStelzner
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): ZIPNET-1149

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@AStelzner
Setting license does not invoke any operation in a separate thread and does not instantiate threads or tasks.
We’ll try to reproduce such error by playing with the license activation in multithreaded environment. Can you roughly explain how your customer uses parallel processes? - Do they use threads or tasks, do async methods involved? - Is their product a web application?
Generally, it unlikely that our licensing code causes the threading exception.

I’ll get back to you when I have the info.

But the exception clearly came from the Aspose.Zip licensing method, see my first post :slight_smile:

Hello @AStelzner, I was able to compose the sample problem that raises System.InvalidOperationException but exception details are not exactly the same.

Run this program on .NET Framework 4.0

internal class Program
{
   public static void Main(string[] args)
   {
      Thread licenseSetting = new Thread(SetLicense);
      Thread comp = new Thread(Compress);
            
      licenseSetting.Start();
      comp.Start(licenseSetting);
            
      licenseSetting.Join();
      comp.Join();
   }


  public static void SetLicense()
  { Aspose.Zip.License l = new License();  l.SetLicense("Aspose.ZIP.NET.lic"); }

  public static void Compress(object t)
  {
    Thread.Sleep(800); // Number of milliseconds depends on your CPU
    Thread licenseSetter = (Thread)t;
    licenseSetter.Abort();
            
    using Archive a = new ();
    a.CreateEntries(".");
    a.Save("folder.zip");
  }
}
1 Like