GroupDocs Viewer .NET Core is throwing Exception "The type initializer for ' threw an exception."

we are using the .NET Core version of GroupDocs Viewer, we have setup the path for local storage and given the file to selectFile method to display it in viewer, Everything is working smooth in local.

when we published the same in docker image and run through container, initially it throw some errors , solved it by providing the license paths from container mount,

now, its throwing the error “The type initializer for ‘#=zmZqCkru6kL4baZ9tJDzE2vDc_ZGa’ threw an exception.” when we hit the loaddocumentdescription method, but everything works smooth in local windows machine. Using all the GroupDocs.Viewer latest dlls from nuget, even updated everything

Attached the docker file for your reference Dockerfile.zip (532 Bytes)

@ATS

When running GroupDocs.Viewer for .NET on Linux the additional dependencies like libgdiplus and basic Windows Fonts should be installed. Add the following instructions to your base image in Dockerfile to install the required libraries and fonts.

RUN sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list
RUN apt update && apt install -y \
	libgdiplus \
    libc6-dev \
    libx11-dev \
	ttf-mscorefonts-installer \
	fontconfig \
    dirmngr \
 && rm -rf /var/lib/apt/lists/*
RUN fc-cache -f -v

You may also need to add SkiaSharp.NativeAssets.Linux.NoDependencies package to you project file in case the version of GroupDocs.Viewer for .NET that you’re using does not reference this package. You can check if SkiaSharp.NativeAssets.Linux.NoDependencies is referenced by your version of GroupDocs.Viewer at the Dependencies tab on NuGet.

And finally, to make System.Drawing work in Linux you have to add runtimeconfig.template.json file to your project files with the following content. Learn more about this config file at System.Drawing.Common only supported on Windows.

{
    "configProperties": {
       "System.Drawing.EnableUnixSupport": true
    }
}

This sample-web-app-with-dockerfile.zip sample application contains all the dependencies and required config file.