Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 30715 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
Created attachment 11448 [details]
Method: Icon.InitFromStreamWithSize (Stream stream, int width, int height)
When constructing a new instance of the Icon class with an .ico file on disk
which contains an PNG image instead of BMP/DIP, an OutOfMemoryException is
C:\Program Files (x86)\Mono\bin
λ mono --debug F:\Program.exe
[ERROR] FATAL UNHANDLED EXCEPTION: System.OutOfMemoryException: Out of memory
at (wrapper managed-to-native) object:__icall_wrapper_mono_gc_alloc_vector (intptr,intptr,intptr)
at (wrapper alloc) object:AllocVector (intptr,intptr)
at System.Drawing.Icon.InitFromStreamWithSize (System.IO.Stream stream, Int32 width, Int32 height) [0x0053e] in C:\buildroot\release\repos\mono\mcs\class\System.Drawing\System.Drawing\Icon.cs:845
at System.Drawing.Icon..ctor (System.String fileName) [0x00018] in C:\buildroot\release\repos\mono\mcs\class\System.Drawing\System.Drawing\Icon.cs:224
at (wrapper remoting-invoke-with-check) System.Drawing.Icon:.ctor (string)
at Program.Main () [0x00000] in <filename unknown>:0
If using an .ico file which' dimensions are 256x256, an Win32Exception is thrown, but it seems like that is caused by a missing implementation instead of a bug: https://github.com/mono/mono/blob/master/mcs/class/System.Drawing/System.Drawing/Icon.cs#L725
mcs command line:
mcs -r:System.Drawing F:/Program.cs
mono command line:
mono --debug F:/Program.cs
public static class Program
public static void Main()
Icon samples attached.
Created attachment 12156 [details]
Adds support for PNG in ICO files.
I've just rebuild mono with this and was able to go beyond the xbuild issue on my vs15 csproj.
Looks like your IDE switched the tabs to spaces.
I wrote that using vim to avoid reformatting : my style is relatively different from the original source's. This would have led to a much bigger patch.
I assume any IDE would re-indent using one's choice.