Bug 3961 - Error in Icon class causes resgen to create invalid icon resources
Summary: Error in Icon class causes resgen to create invalid icon resources
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Drawing ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-03-18 23:33 UTC by Seth Randall
Modified: 2012-10-11 07:25 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Patch (1.30 KB, patch)
2012-03-18 23:33 UTC, Seth Randall
Details
Test app (135.75 KB, application/zip)
2012-03-18 23:34 UTC, Seth Randall
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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 3961 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 original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Seth Randall 2012-03-18 23:33:51 UTC
Created attachment 1533 [details]
Patch

resgen uses the Icon.InitFromStreamWithSize method to create a .resource file from a .resx file. If the Icon in the .resx file has a 256x256 PNG icon as one of its parts, the method will strip the PNG out. However, the method doesn't adjust the offsets in the Icon before writing it out. This causes the application to crash when it runs because it looks for the icon data in the wrong place. Attached is a patch to fix the issue and a C# project to test it.

To test error
1. Build the application normally
2. Run
3. Receive an error when trying to load the image with the PNG in it

To test the fix
1. Apply the patch to the current Mono install.
2. Delete the Form1.resources file to force MonoDevelop to rebuild it
3. Build the application normally
4. Run
5. The images should now appear properly regardless of which button is selected
Comment 1 Seth Randall 2012-03-18 23:34:48 UTC
Created attachment 1534 [details]
Test app
Comment 2 Gary____ 2012-10-11 07:25:04 UTC
I think this has been fixed in master.