0

i have problems during creating image from stream. on my windows pc it forks great, on ubuntu server, it throws an error

System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter] at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status) <0x00157> at System.Drawing.Image.CreateFromHandle (intptr) <0x00027> at System.Drawing.Image.LoadFromStream (System.IO.Stream,bool) <0x0002b> at System.Drawing.Image.FromStream (System.IO.Stream,bool,bool) <0x00013>

I checked System.Drawing library setup on my server, it says that system.drawing is installed

mono-test-install

Your have a working System.Drawing setup

any ideas?

ardabada
  • 105
  • 11

1 Answers1

1

First, locate the directory where is the System.Drawing.dll file (for example /opt/mono-4.4.0/lib/gac/System.Drawing/4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll).

Create a file in the same directory called System.Drawing.dll.config with the following content, updating the directory to the correct location of libgdiplus.so:

<configuration>
  <dllmap dll="gdiplus.dll" target="/opt/mono-4.4.0/lib/libgdiplus.so"/>
</configuration>
Robin Daugherty
  • 7,115
  • 4
  • 45
  • 59
dougstefe
  • 26
  • 3
  • this didn't seem to make any difference for me - how can I check that this config file is being used? – mcmillab Sep 19 '18 at 07:32
  • according to this link: https://social.msdn.microsoft.com/Forums/vstudio/en-US/65590173-69d7-4ca1-a313-61d1ddb4b1e2/application-settings-in-dllconfig?forum=csharpgeneral dll.config files are not used at runtime... so I'm confused about how this would work? – mcmillab Sep 19 '18 at 07:59