This documentation addresses common errors encountered when using Aspose.Words for document conversion (e.g., to PDF, JPEG, PNG) in a .NET Core 2.0 application running inside a Docker container. The errors typically relate to SkiaSharp type initializers and occur only in Docker environments (not in local IIS Express).
1. PDF Conversion Error
The type initializer for ‘SkiaSharp.SKManagedStream’ threw an exception.
2. JPEG/PNG Conversion Error
The type initializer for ‘SkiaSharp.SKImageInfo’ threw an exception.
The errors stem from missing native dependencies required by the SkiaSharp library, which Aspose.Words uses for rendering graphics. Docker containers (especially lightweight Linux-based images) often lack these dependencies by default.
Add the necessary native libraries to your Docker image. These include:
Update your Dockerfile to include these dependencies:
Ensure the SkiaSharp.NativeAssets.Linux NuGet package is installed in your project. This package provides Linux-specific binaries required for SkiaSharp to work in Docker.
dotnet add package SkiaSharp.NativeAssets.Linux –version 2.88.0
Note: Use a version compatible with your project and Aspose.Words.
Avoid using minimal Docker images (e.g., alpine), as they lack essential dependencies. Use a Debian/Ubuntu-based image instead:
If fonts are missing (common in headless Docker environments), explicitly install fonts or copy them to the container:
# Example: Install DejaVu fonts
RUN apt-get install -y ttf-dejavu
Run the Docker container in debug mode to capture detailed error logs:
docker run -it –rm your-image-name
docker build --no-cache -t your-image-name
If the issue persists, contact Aspose Support with your Dockerfile, error logs, and a reproducible sample. Work with our skilled .Net developers to accelerate your project and boost its performance.
3rd Floor, Aval Complex, University Road, above Balaji Super Market, Panchayat Nagar Chowk, Indira Circle, Rajkot, Gujarat 360005.
Abbotsford, BC
15th B Street 103, al Otaiba Dubai DU 00000, United Arab Emirates
3rd Floor, Aval Complex, University Road, above Balaji Super Market, Panchayat Nagar Chowk, Indira Circle, Rajkot, Gujarat 360005.
Abbotsford, BC
15th B Street 103, al Otaiba Dubai DU 00000, United Arab Emirates
Copyright © 2026 Niotechone Software Solution Pvt. Ltd. All Rights Reserved.