Thanks to visit codestin.com
Credit goes to github.com

Skip to content

System.Drawing.Bitmap.FromFile throws ArgumentException on  #10062

@to-st

Description

@to-st

Steps to Reproduce

  1. unzip testcase.zip
  2. csc Program.cs
  3. mono Program.exe

Current Behavior

libpng error: invalid after png_start_read_image or png_read_update_info

Unhandled Exception:
System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter]
at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status) [0x00098] in :0
at System.Drawing.Image.FromFile (System.String filename, System.Boolean useEmbeddedColorManagement) [0x00026] in :0
at System.Drawing.Image.FromFile (System.String filename) [0x00000] in :0
at ConsoleApplication1.Program.Main (System.String[] args) [0x00001] in <0be2a1fafcfa4b86a432c8bb1f0489d8>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter]
at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status) [0x00098] in :0
at System.Drawing.Image.FromFile (System.String filename, System.Boolean useEmbeddedColorManagement) [0x00026] in :0
at System.Drawing.Image.FromFile (System.String filename) [0x00000] in :0
at ConsoleApplication1.Program.Main (System.String[] args) [0x00001] in <0be2a1fafcfa4b86a432c8bb1f0489d8>:0

Expected Behavior

AggregationAvg.png is correctly loaded (MS .NET Framework does so).
pngcheck reports no errors.
eog is also able to display the image.

On which platforms did you notice this

[ ] macOS
[x] Linux (debian 9.5 x86_64)
[ ] Windows

Version Used:

Mono JIT compiler version 4.6.2 (Debian 4.6.2.7+dfsg-1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen

and

Mono JIT compiler version 5.19.0 (master/1dd7629f257 Fr 10. Aug 13:35:41 CEST 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(4)
Suspend: hybrid
GC: sgen (concurrent by default)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions