Bug 244 - System.Drawing.Graphics.FromHwnd crashes with an EntryPointNotFoundException
Summary: System.Drawing.Graphics.FromHwnd crashes with an EntryPointNotFoundException
Status: RESOLVED DUPLICATE of bug 273
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Drawing ()
Version: 2.10.x
Hardware: Macintosh Mac OS
: --- critical
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-08-09 12:43 UTC by Dimitar Dobrev
Modified: 2011-08-23 11:25 UTC (History)
3 users (show)

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


Attachments
Test project to repro the defect (8.55 KB, application/zip)
2011-08-15 15:50 UTC, David Lein
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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 273

Description Dimitar Dobrev 2011-08-09 12:43:46 UTC
System.Drawing.Graphics.FromHwnd, used internally very often, crashes with an EntryPointNotFoundException.

Steps to reproduce:
1. Call System.Drawing.Graphics.FromHwnd with a valid pointer.

Expected results:
A valid System.Drawing.Graphics object is returned.

Actual results:
The app crashes with the following:

System.EntryPointNotFoundException: GdipCreateFromContext_macosx
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdipCreateFromContext_macosx (intptr,int,int,intptr&)
  at System.Drawing.Graphics.FromHwnd (IntPtr hwnd) [0xd014c951] in <filename unknown>:0


Works in the last 2.10.2, fails with both 2.10.3_3 and 2.10.3_5. <a href="https://bugzilla.novell.com/show_bug.cgi?id=538539">The bug is also listed here but for Mono 2.4.x. It's not marked as fixed, though.</a>
Comment 1 David Lein 2011-08-15 15:07:00 UTC
I'm also seeing this in our app. Just create a simple Windows.Forms app with nothing but a text box to repro. This breaks any winforms app. The call stack is similar:


System.EntryPointNotFoundException: GdipCreateFromContext_macosx
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdipCreateFromContext_macosx (intptr,int,int,intptr&)
  at System.Drawing.Graphics.FromHwnd (IntPtr hwnd) [0x00054] in /private/tmp/monobuild/build/BUILD/mono-2.10.4/mcs/class/System.Drawing/System.Drawing/Graphics.cs:1733 
  at System.Windows.Forms.Control.CreateGraphics () [0x00011] in /private/tmp/monobuild/build/BUILD/mono-2.10.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3550 
  at System.Windows.Forms.TextBoxBase.CreateGraphicsInternal () [0x0000b] in /private/tmp/monobuild/build/BUILD/mono-2.10.4/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs:1738 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TextBoxBase:CreateGraphicsInternal ()
...
Comment 2 David Lein 2011-08-15 15:50:51 UTC
Created attachment 128 [details]
Test project to repro the defect
Comment 3 Alex Corrado [MSFT] 2011-08-23 11:25:43 UTC

*** This bug has been marked as a duplicate of bug 273 ***