Free Support Forum - aspose.com

System.DllNotFoundException in net core app. Docker for linux


#1

Hello.
I use the Aspose.BarCode 19.2.0 library.

If I run the net core 2.2. application from under Windows, everything works correctly. But when I run the application from under Docker on the Linux platform, I see an error
Exception thrown: ‘System.DllNotFoundException’ in SkiaSharp.dll
Full StackTrace
“The type initializer for ‘SkiaSharp.SKAbstractManagedStream’ threw an exception.”, “Level”: “ERROR”, “exception.message”: “The type initializer for ‘SkiaSharp.SKAbstractManagedStream’ threw an exception.”, "Exception.stacktrace “:” at SkiaSharp.SKAbstractManagedStream…ctor (Boolean owns) \ n at \ u000F. \ u0002 (Stream \ u0002) \ n at \ u000F …ctor (Stream \ u0002) \ n at Aspose.BarCode.Bitmap … ctor (Stream stream) \ n at Aspose.BarCode.BarCodeRecognition.BarCodeReader.SetBarCodeImage (Stream stream) \ n at Aspose.BarCode.BarCodeRecognition.BarCodeReader…ctor (Stream stream, BaseDecodeType type) \ n


#2

@Gleb,

Thanks for your query.

Please share your simplest runnable solution which is running in your underlying environment and can be used here to reproduce the scenario for our analysis.


#3

Thanks for the quick response to my question.
The archive contains an example application. Error at startup can be viewed on the video https://youtu.be/aNziwmJQOmk or run the application.SimplestApp.zip (911.2 KB)


#4

@Gleb,

We are working on this issue and creating environment to re-produce it here. We will write back here as soon as this issue is analyzed and feedback is ready to share.


#5

@Gleb,

I have created a simple console project for .NET Core and found it working fine in Windows and Ubuntu container in Docker. Then reference to Aspose.BarCode is added using NuGet package manager to the project and simple code for generating a sample barcode is added as given below:

// Instantiate barcode object and set differnt barcode properties
BarCodeGenerator generator = new BarCodeGenerator(EncodeTypes.Code128, "1234567");
generator.XDimension.Millimeters = 1f;
// Save the image to your system and set its image format to Jpeg
generator.Save("barcode-codetext_out.jpg", BarCodeImageFormat.Jpeg);

This project is tested in Windows and it works fine. However when same project is executed in Docker, above mentioned exception is observed as shared by you.

To resolve this issue I published the application using Visual Studio 2017 and executed the application from that published folder in Docker. It is observed that this time application executed successfully without any exception and barcode image was created. As during publishing, all the dependencies are resolved and made part of the published folder, you may please publish your application and execute application from this published folder. Please provide your feedback after publishing the application and testing in Docker.


#6

Hey. I tried to build and run the image of my application. As a result, I see the same error. In the workplace, CI / CD collects the image under the kubernetes and there we see the same error. I tried to lower the version of NET CORE (https://github.com/mono/SkiaSharp/issues/517) but without result.


#7

I found this solution

Docker container starts successfully. On Monday I will try to implement the solution in the CI assembly.


#8

@Gleb,

Thank you for the feedback. When we publish the application, it contains all these dependencies. Good to know that you also found the solution and we will wait for your feedback once you test it in your environment.


#9

@ahsaniqbalsidiqui
I managed to launch the above solution, but in the future I want to have the fix of the Aspose.BarCode library. Is there any suggestion when to expect this?


#10

@Gleb,
Please spare us little time for discussing this issue here. We will write back here once any feedback is ready to share.


#11

@Gleb,
It looks like Linux binary is not shipped with SkiaSharp. Therefore you have used the right approach to use the assembly at https://github.com/mono/SkiaSharp/releases .
If you download its NuGet package then it should be the latest version. Please put the downloaded SkiaSharp library in the same folder where loader can find it and it should work.


#12

Hey. This file must be placed in the nuget folder of the SkiaSharp package. When updating SkiaSharp, you will have to download and place the file in a new package. If you work locally, it is tolerable, but if you collect a project on CI, sooner or later it helps to catch the bug. So far, unfortunately, I cannot offer another solution.

I would recommend adding this solution to the documentation. I think this question will arise for many clients.


#13

@Gleb,

We are further looking into this issue and have logged it as BARCODENET-37144 for detailed analysis. We will write back here once any update is ready to share here.


#14

A post was split to a new topic: System.DllNotFoundException: Unable to load shared library ‘libSkiaSharp’