System.DllNotFoundException in net core app. Docker for linux

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


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.

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


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.


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.

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 (Linux : System.DllNotFoundException: Unable to load DLL 'libSkiaSharp' · Issue #517 · mono/SkiaSharp · GitHub) but without result.

I found this solution

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


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.

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?

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

It looks like Linux binary is not shipped with SkiaSharp. Therefore you have used the right approach to use the assembly at .
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.

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.


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.

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