0

I am trying to write a Dynamics 365 plugin using Aspose.Barcode, however, every time I try to set the license or extract a barcode the library throws a System.IO.EndOfStreamException "Attempted to read past the end of the stream" exception.

For example I have the following lines of code in the application to set the licence:

string license = GetAsposeLicense();
byte[] byteArray = Encoding.ASCII.GetBytes(license);
using (MemoryStream stream = new MemoryStream(byteArray))
{
    License barCodeLicense = new License();
    barCodeLicense.SetLicense(stream);
}

The funny thing is the same lines of code work perfectly fine when used in a Console application; both written in dotnet Framework 4.5.2. I am using ILMerge to merge all the assemblies into one Dynamics 365 plugin library.

I guess my questions are:

  1. Do Dynamics 365 plugins have issues working with streams?
  2. Could it be an issue with ILMerge?
  3. Is there a potential workaround?
Mick.W
  • 1
  • 1
  • When `string license = GetAsposeLicense();` has been executed, is `license` set to a valid license string? You could write its value to the plugin trace log. – Henk van Boeijen Mar 03 '22 at 21:42

1 Answers1

0
  1. Can be
  2. Can be
  3. Move the logic to Azure (like an Azure Function or similar) or find another library
Guido Preite
  • 14,905
  • 4
  • 36
  • 65
  • Thank you for your reply. I am thinking the same and just reaching out to Aspose to check if I can do that given my current licence. If they confirm I can use the library in an Azure function then I will mark your answer as the solution. Thanks again. – Mick.W Mar 02 '22 at 13:29
  • Sadly Aspose have confirmed that if their product is used within an API/Azure function for both external and internal uses then you require the high end licenses. – Mick.W Mar 02 '22 at 14:27