Aspose PDF library throwing - Unhandled exception. System.TypeLoadException: Cannot load type 'System.Void, mscorlib

376 views Asked by At

I'm getting this exception "Unhandled exception. System.TypeLoadException: Cannot load type 'System.Void, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'." While using Aspose PDF in our QA env, which is dockerized from the base images "dotnet/sdk:6.0-alpine" and "dotnet/runtime-deps:6.0-alpine" .

Is there any compatibility issue between these images and Aspose?

Aspose Library version: 22.12.0 (Even tried with 23.1.0)

NOTE: This is only occurring in QA environment where we have dockerized the application, but working fine in Dev environment where no Dockerization happening?

1

There are 1 answers

0
Sreeraj TR On

This issue is fixed in our environment. The rootcause was the dotnet publish options present in the Dockerfile. PublishTrimmer=true, which trimmed some required classes which required for Aspose to run it seems. Started working once we removed this parameter.