Unable to load DLL ‘libSkiaSharp’

Hi. We are experiencing the same issue when we deploy to our higher environments, but we did not have the issue in our lower environments, which are configured differently. Is there a solution to this issue or a work around?

@tashaoverton,

Thanks for your inquiry. We already logged this problem in our issue tracking system as WORDSNET-16749. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Could you please share your working environment along with stack trace? Thanks for your cooperation.

Below is the stack trace. I have requested our server team to provide specs, I will send that as soon as I receive it.

The code is an API written in C# .NET Core 2.0 hosted in IIS.

We need a work around for this issue as it is stopping us from being in production and we are under deadline. So please advise on how we can get past this, so testing can complete for our 6/4 release.

 System.TypeInitializationException: The type initializer for 'SkiaSharp.SKManagedStream' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'libSkiaSharp': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
    at SkiaSharp.SkiaApi.sk_managedstream_set_delegates(IntPtr pRead, IntPtr pPeek, IntPtr pIsAtEnd, IntPtr pRewind, IntPtr pGetPosition, IntPtr pSeek, IntPtr pMove, IntPtr pGetLength, IntPtr pCreateNew, IntPtr pDestroy)
    at SkiaSharp.SKManagedStream..cctor()
    --- End of inner exception stack trace ---
    at SkiaSharp.SKStream.WrapManagedStream(Stream stream)
    at SkiaSharp.SKBitmap.Decode(Stream stream)
    at 
   .[1]()
    at 
   .[1](Stream [1], SKRectI 
 ________________________________________
 , Boolean& )
    at 
   .[1](Stream [1], 
 ________________________________________
    
 ________________________________________
 , SKRectI , Boolean& )
    at [1]  ..ctor(Byte[] [1], SKRectI 
 ________________________________________
 )
    at [1]  ..ctor(Byte[] [1])
    at   .[1]()
    at   .[1](Stream [1])
    at    .[1]()
    at    .      
 ________________________________________
 ()
    at    .      [1](    [1])
    at    .[1]      [1](    [1])
    at 
    .[1](    [1])
    at    .[1]()
    at 
 ________________________________________
    .      [1]()
    at    .      [1](    [1])
    at 
    .
       [1](    [1])
    at Aspose.Words.Document.[1](    [1], SaveOptions 
 ________________________________________
 )
    at Aspose.Words.Document.[1](Stream [1], String 
 ________________________________________
 , SaveOptions )
    at WrittenNotification.Api.Document.Controllers.DocumentController.GetResultBytes(Guid requestKey, Document document) in E:\agent_Release\agent\_work\188\s\src\WrittenNotification.Api.Document\Controllers\DocumentController.cs:line 158
    at WrittenNotification.Api.Document.Controllers.DocumentController.<MergeDataToFields>d__13.MoveNext() in E:\agent_Release\agent\_work\188\s\src\WrittenNotification.Api.Document\Controllers\DocumentController.cs:line 120
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at lambda_method(Closure , Object )
    at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
    at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeInnerFilterAsync>d__14.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextResourceFilter>d__22.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeFilterPipelineAsync>d__17.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeAsync>d__15.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at WrittenNotification.Common.SerilogMiddleware.<Invoke>d__4.MoveNext() in E:\agent_Release\agent\_work\188\s\src\WrittenNotification.Common\SerilogMiddleware.cs:line 33
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.<Invoke>d__11.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.AspNetCore.Builder.Extensions.UsePathBaseMiddleware.<Invoke>d__3.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext()
 --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Frame`1.<ProcessRequestsAsync>d__2.MoveNext()

We are using 3 load balanced Windows Server 2012 R2 Standard (full installation) build 9600, 64bit, virtual vmware for our server.

We have the same deployment working in our lower environments on a single Windows Server 2016, Version 1607 build 14393, 64bit, virtual vmware.

What are the operating system requirements for Aspose using .NET Core 2.0?

@tashaoverton,

Thanks for sharing the detail. We reproduced the issue WORDSNET-16749 by building .NET core 2.0 application at Windows 10 and publish it on Ubuntu operating system.

Could you please share the steps that you are using to reproduce your issue at our end? We will then log separate issue for your case. Thanks for your cooperation.

@tashaoverton,

Thanks for your patience. This is not a bug. This is kind of limitation of SkiaSharp that is used by Aspose.Words .NET Standard version. SkiaSharp NuGet package does not contain native skia library for Linux, so it is required to add it manually.

  1. Create ne .NET Core Console Application
  2. Please install Aspose.Words for .NET through NuGet.
  3. Aspose.Words for .NET Standard uses SkiaSharp, which does not have native Skia library for Linux in its NuGet package yet. However, it is not a problem, because this native library is published with every SkiaSharp release on Github. Please note that Aspose.Words uses SkiaSharp 1.60.1, so download libHarfBuzzSharp.so file for this version. Once you download it, add it in your project and set “Copy to output directory”.
  4. Write code that uses Aspose.Words.
  5. Than open cmd line in folder where project file is and run this command:
  6. dotnet publish -r ubuntu.16.04-x64

    dotnet publish -r ubuntu.16.04-x64

  • Copy output ubuntu build folder to Ubuntu
  • Installing .NET Core 2.0 on Ubuntu (https://github.com/dotnet/docs/blob/master/docs/core/linux-prerequisites.md)
  • Open Ubuntu machine terminal (CLI) and Go to the project directory
  • Provide execute permissions:

    chmod 777 ./appname

  • Execute application

    ./appname

The issues you have found earlier (filed as WORDSNET-16749) have been fixed in this Aspose.Words for .NET 18.9 update and this Aspose.Words for Java 18.9 update.