The type initializer for 'gdip' threw an exception on linux ubuntu

Dung Do Tien Feb 12 2020 2713

Hi There,

I have an 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.

Have 2 answer(s) found.
  • M

    Manish Kumar Feb 18 2020

    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.

  • M

    Mary Christ Mar 02 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? 

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close