Aspose.Cells in AWS Lambda .NET Core 2.1 Function: Exception when saving to PDF


“errorType”: “CellsException”,
“errorMessage”: “The type initializer for '\u000f ’ threw an exception.”,
“stackTrace”: [
“at Aspose.Cells.Workbook.Save(Stream stream, SaveOptions saveOptions)”

How can I fix this?



Thanks for providing us details.

We did try this scenario for Aspose.Cells using Docker container assuming that “AWS Lambdas” is similar to docker container. We have tested this issue on Ubuntu 16.04 x64, in a docker container.
Here are our steps:

The docker we used was: microsoft/dotnet, install it first:
sudo docker pull microsoft/dotnet

Then, after running it straight away, we got the issue in this docker, We got the similar error upon saving to PDF.
We did the following things to sort it out:

We installed libgdiplus:

apt-get update
apt-get install -y libgdiplus
cd /usr/lib && ln -s gdiplus.dll
And install libc6-dev:
apt-get install -y --no-install-recommends libc6-dev

After doing all these steps, the issue passed away, and the PDF file was created successfully.
Would you please check it and share the feedback?



I managed to make it work by using lambda custom runtime (.net core 3) and lambda layer containing libgdiplus.x86_64 and glibc-devel.x86_64.

However now i encounter (sometimes) a different type of error:
“errorType”: “CellsException”,
“errorMessage”: “Shape to image Error!”,
“stackTrace”: [
“at Aspose.Cells.Workbook.Save(Stream stream, SaveOptions saveOptions)”

I cannot reproduce this on windows.

I use Aspose.Cells 19.9.0

Any idea how i can make this work?



Can you provide us sample code (runnable) and template file (if any) to reproduce the issue, we will check it soon.

#5 (149.1 KB)


I attached code and a file to reproduce the issue I mention.
I managed to reproduce it on AMI Linux.

I have already installed libgdiplus.x86_64 and glibc-devel.x86_64 on that Linux instance.
The zip I attached is light (has to be rebuilt and published)

Hope this helps. If there is any other info I can provide please let me know.


We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNETCORE-34 – Exception "Shape to image Error!" while converting XLS to PDF



We evaluated your issue in details. We tested it on windows, MAC, linux, and found System.drawing.common does not support EMF on linux very well. Also saving EMF files will cause error on linux(Ubuntu 16.04 x64).
Sample code:

Image image0 = Image.FromFile("file.emf");
 image0.Save("file2.emf", System.Drawing.Imaging.ImageFormat.Emf);//on linux it fails

To make it more clear, we created a test project, please find it attached.

Probably we will skip EMF drawing on linux, to make sure the main file can be drawn properly, but some EMF elements will be missing until Microsoft fix this.

Thanks for your understanding! (533.6 KB)