The type initializer for ‘System.Drawing.GDIPlus’ threw an exception

Dung Do Tien Dec 04 2020 524

In CentOS7 I installed the libgdiplus package, but I got the below error:

Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'gdiplus': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
at System.Drawing.GDIPlus.GdiplusStartup(UInt64& token, GdiplusStartupInput& input, GdiplusStartupOutput& output)
at System.Drawing.GDIPlus..cctor()
--- End of inner exception stack trace ---
at System.Drawing.GDIPlus.GdipLoadImageFromFile(String filename, IntPtr& image)
at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
at System.Drawing.Image.FromFile(String filename)
at ConsoleApplication.Program.Main(String[] args)
and run find / -name 'libgdiplus*',the result is below:
/usr/local/lib/pkgconfig/libgdiplus.pc
/usr/local/lib/libgdiplus.so.0.0.0
/usr/local/lib/libgdiplus.so.0
/usr/local/lib/libgdiplus.so
/usr/local/lib/libgdiplus.la
/usr/local/lib/libgdiplus.a

It's working fine in the window environment. Please suggest to me if you know any solution.

Have 1 answer(s) found.
  • M

    Manish Kumar Dec 04 2020

    This issue related to GDI+, You have to sure that it is installed at all. If not you can run the command below:

    sudo apt-get install libgdiplus
    cd /usr/lib
    sudo ln -s libgdiplus.so gdiplus.dll
    

    Run command line by line and try to restart your server.

    I hope it resolves the issue for you.

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