Mick.W
Mick.W

Reputation: 1

Aspose.Barcode - Attempted to read past the end of the stream exception in Dynamics 365 plugin

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?

Upvotes: 0

Views: 122

Answers (1)

Guido Preite
Guido Preite

Reputation: 15138

  1. Can be
  2. Can be
  3. Move the logic to Azure (like an Azure Function or similar) or find another library

Upvotes: 0

Related Questions