I have just faced the same issue after I added Aspose.Words v22.9.0 as the dependency to my .NET 5.0 project. I’m running the project in the Docker container. Here is my Dockerfile
for the reference:
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
LABEL stage=builder
WORKDIR /solution
COPY . .
WORKDIR /solution/src/project
RUN --mount=type=cache,target=/root/.nuget dotnet publish "Project.csproj" -c Release -o /app/publish
FROM mcr.microsoft.com/dotnet/aspnet:5.0
RUN apt-get update && apt-get install -y libfontconfig1
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "Project.dll"]
Here are the exception details:
System.TypeInitializationException: The type initializer for 'Fo' threw an exception.
---> System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' 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_colortype_get_default_8888()
at SkiaSharp.SKImageInfo..cctor()
--- End of inner exception stack trace ---
at SkiaSharp.SKBitmap..ctor(Int32 width, Int32 height, Boolean isOpaque)
at Fo..cctor()
--- End of inner exception stack trace ---
at Fo..ctor(Byte[] a)
at YZa.v()
at YZa.q(Boolean a, Boolean b, q7 c)
at e0a.u(Shape a)
at e0a.t(Shape a)
at e0a.r(Shape a)
at e0a.h(ShapeBase a)
at e0a.e(ShapeBase a)
at l0a.VisitShapeStart(Shape a)
at Aspose.Words.Drawing.Shape.r3ka8zscesabkstb24kjjv9sml9wq7pwMiB(DocumentVisitor a)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.Drawing.Shape.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
at l0a.l0aMiB(w4a a)
at bpa.bpaMib(w4a a)
at Aspose.Words.Document.Ya(w4a a)
at Aspose.Words.Document.La(Stream a, String b, SaveOptions c)