I have been trying to resolve the follownig error while running within a Docker Container and Linux.
Unhandled exception. System.TypeInitializationException: The type initializer for 'SkiaSharp.SKObject' threw an exception.
[340](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:341)tests-1 | ---> System.DllNotFoundException: Unable to load shared library 'libSkiaSharp' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
[341](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:342)tests-1 | libfontconfig.so.1: cannot open shared object file: No such file or directory
[342](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:343)tests-1 | /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/libSkiaSharp.so: cannot open shared object file: No such file or directory
[343](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:344)tests-1 | /sln/tests/BizCover.Integration.Service.DocumentGeneration.IntegrationTests/bin/Release/net8.0/libSkiaSharp.so: cannot open shared object file: No such file or directory
[344](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:345)tests-1 | /sln/tests/BizCover.Integration.Service.DocumentGeneration.IntegrationTests/bin/Release/net8.0/runtimes/linux-x64/native/liblibSkiaSharp.so: cannot open shared object file: No such file or directory
[345](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:346)tests-1 | /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/liblibSkiaSharp.so: cannot open shared object file: No such file or directory
[346](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:347)tests-1 | /sln/tests/BizCover.Integration.Service.DocumentGeneration.IntegrationTests/bin/Release/net8.0/liblibSkiaSharp.so: cannot open shared object file: No such file or directory
[347](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:348)tests-1 | /sln/tests/BizCover.Integration.Service.DocumentGeneration.IntegrationTests/bin/Release/net8.0/runtimes/linux-x64/native/libSkiaSharp: cannot open shared object file: No such file or directory
[348](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:349)tests-1 | /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/libSkiaSharp: cannot open shared object file: No such file or directory
[349](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:350)tests-1 | /sln/tests/BizCover.Integration.Service.DocumentGeneration.IntegrationTests/bin/Release/net8.0/libSkiaSharp: cannot open shared object file: No such file or directory
[350](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:351)tests-1 | /sln/tests/BizCover.Integration.Service.DocumentGeneration.IntegrationTests/bin/Release/net8.0/runtimes/linux-x64/native/liblibSkiaSharp: cannot open shared object file: No such file or directory
[351](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:352)tests-1 | /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/liblibSkiaSharp: cannot open shared object file: No such file or directory
[352](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:353)tests-1 | /sln/tests/BizCover.Integration.Service.DocumentGeneration.IntegrationTests/bin/Release/net8.0/liblibSkiaSharp: cannot open shared object file: No such file or directory
[353](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:354)tests-1 | at SkiaSharp.SkiaApi.sk_version_get_milestone()
[354](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:355)tests-1 | at SkiaSharp.SkiaSharpVersion.get_Native()
[355](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:356)tests-1 | at SkiaSharp.SkiaSharpVersion.CheckNativeLibraryCompatible(Boolean throwIfIncompatible)
[356](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:357)tests-1 | at SkiaSharp.SKObject..cctor()
[357](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:358)tests-1 | --- End of inner exception stack trace ---
[358](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:359)tests-1 | at SkiaSharp.SKObject.DeregisterHandle(IntPtr handle, SKObject instance)
[359](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:360)tests-1 | at SkiaSharp.SKObject.set_Handle(IntPtr value)
[360](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:361)tests-1 | at SkiaSharp.SKNativeObject.Dispose(Boolean disposing)
[361](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:362)tests-1 | at SkiaSharp.SKObject.Dispose(Boolean disposing)
[362](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:363)tests-1 | at SkiaSharp.SKBitmap.Dispose(Boolean disposing)
[363](https://github.com/BizCover/BizCover.Integration.Service.DocumentGeneration/actions/runs/8148326971/job/22270923180#step:9:364)tests-1 | at SkiaSharp.SKNativeObject.Finalize()
I have many different fixes without much luck, I have tried using SkiaSharp.NativeAssets.Linux (V2.88.7) and still no luck.
# Arguments
ARG BUILD_VERSION="1.0.0"
# Base
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
RUN apt-get clean
#RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list.d/debian.sources
RUN apt-get update;
RUN apt-get update; apt-get install -y fontconfig fonts-liberation
RUN apt install fonts-open-sans
COPY .../Fonts/*.* ./usr/share/fonts/truetype/
RUN fc-cache -f -v
WORKDIR /app
EXPOSE 80
EXPOSE 443
# Build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /sln
RUN for file in $(ls *.csproj); do mkdir -p ./src/${file%.*}/ && mv $file ./src/${file%.*}/; done
COPY tests/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p ./tests/${file%.*}/ && mv $file ./tests/${file%.*}/; done
RUN dotnet restore
COPY . .
RUN dotnet build --no-restore -c Release
# Test
FROM build AS tests
# Publish
FROM build AS publish
WORKDIR /sln/src/...
RUN dotnet publish --no-build -c Release -o /artifacts/server
# Run
FROM base AS final
WORKDIR /app
RUN apt-get update
RUN apt-get install -y libgdiplus
COPY --from=publish /artifacts/server .
Current version of Aspose.Words is 23.8.0