The type initializer for 'gdip' threw an exception on linux ubuntu
I have an asp.net core application for upload image and I deploy it to docker Linux Ubuntu 18, after upload I get an error The type initializer for 'gdip' threw an exception on linux . I Can not upload image on lunix but it working well on local window 10 of my computer.
Pls tell me any solutions.
This error occurs when you using System.Drawing package in .Net but this package is not install on your server. You can install this package through Dockerfile.
Copy this code and paste to the end of your dockerfile.
# install System.Drawing native dependencies RUN apt-get update \ && apt-get install -y --allow-unauthenticated \ libc6-dev \ libgdiplus \ libx11-dev \ && rm -rf /var/lib/apt/lists/*
I hope this works for you.Manish Kumar Feb 18 2020
Thank many Manish Kumar.
It worked for me.
As me kown this package is managed by Nuget. Can you explain to me why this package is not download when docker build?Mary Christ Mar 02 2020