‘SkiaSharp.SKImageInfo’ Exception in Aspose Word v18.8.0 ‘SkiaSharp.SKImageInfo’ Exception in Aspose Word v18.8.0 docker docker

‘SkiaSharp.SKImageInfo’ Exception in Aspose Word v18.8.0


Aspose.Words 18.8 used SkiaSharp 1.60.3 version. Goelze.SkiaSharp.NativeAssets.AlpineLinux required SkiaSharp 1.68.0 or newer. You should update to Aspose.Words 19.2.0 version (in this version 1.68.0 version of SkiaSharp is used). Or to the latest version, which uses 1.68.1 version of SkiaSharp.

You have to add Linux native assets for SkiaSharp to make it work in Linux Alpine. Add Nuget referenace to Goelze.SkiaSharp.NativeAssets.AlpineLinux. Also do not forget to install fontconfig in your container. It is required by SkiaSharp to work with fonts. Here is Dockerfile I used for testing Aspose.Words in Linux Alpine container.

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-alpine3.9 AS buildWORKDIR /app# copy csproj and restore as distinct layersCOPY Aspose.Words.Docker.Sample/*.csproj ./Aspose.Words.Docker.Sample/WORKDIR /app/Aspose.Words.Docker.SampleRUN dotnet restore# copy and publish app and librariesWORKDIR /app/COPY Aspose.Words.Docker.Sample/. ./Aspose.Words.Docker.Sample/WORKDIR /app/Aspose.Words.Docker.SampleRUN dotnet publish -c Release -o out# copy to runtime environmentFROM mcr.microsoft.com/dotnet/core/runtime:2.2-alpine3.9 AS runtimeWORKDIR /app# fontconfig is required to properly work with fonts in Linux.RUN apk update && apk upgrade && apk add fontconfigCOPY --from=build /app/Aspose.Words.Docker.Sample/out ./ENTRYPOINT ["dotnet", "Aspose.Words.Docker.Sample.dll"]

Note, Goelze.SkiaSharp.NativeAssets.AlpineLinux is compiled for Alpine Linux 3.9 and does not work on 3.8.

Disclosure: I work at Aspose.Words team.