Unable to load shared library 'libSkiaSharp' on Azure with Ubuntu

Hi
I have an Azure Pipeline with my .Net Core 5 project. In my project I referenced the Nuget-Package Aspose.Words version 21.7.0. I have a test for generating a document. On my Windows 10 machine all works fine. On Azure in my Pipeline the build works, but the test failes with this error:

The active test run was aborted. Reason: Test host process crashed : Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibSkiaSharp: cannot open shared object file: No such file or directory
   at SkiaSharp.SkiaApi.sk_version_get_milestone()
   at SkiaSharp.SkiaSharpVersion.get_Native()
   at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
   at SkiaSharp.SKObject..cctor()
   --- End of inner exception stack trace ---
   at SkiaSharp.SKObject.DeregisterHandle(IntPtr handle, SKObject instance)
   at SkiaSharp.SKObject.set_Handle(IntPtr value)
   at SkiaSharp.SKNativeObject.Dispose(Boolean disposing)
   at SkiaSharp.SKObject.Dispose(Boolean disposing)
   at SkiaSharp.SKBitmap.Dispose(Boolean disposing)
   at SkiaSharp.SKNativeObject.Finalize()

What can I do?

@marco.wittwer Aspose.Words for .NET Standard uses SkiaSharp to deal with graphics. To make it work on Linux you should also add Nuget reference to SkiaSharp.NativeAssets.Linux.NoDependencies.

1 Like

Thank you, this works.