Bug 23553 - 3.10 regression on libgdiplus
Summary: 3.10 regression on libgdiplus
Status: VERIFIED FIXED
Alias: None
Product: Installers
Classification: Mono
Component: General (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- critical
Target Milestone: 3.10.0
Assignee: Bugzilla
URL:
: 23471 23902 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-02 12:49 UTC by Chris Hamons
Modified: 2014-11-07 16:22 UTC (History)
10 users (show)

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


Attachments
Test Case (5.78 MB, application/zip)
2014-10-02 12:49 UTC, Chris Hamons
Details

Description Chris Hamons 2014-10-02 12:49:11 UTC
Created attachment 8288 [details]
Test Case

From desk: https://xamarin.desk.com/agent/case/91022

Open and run the associated program on mono 3.8 (no problems).
Run it on 3.10

Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.EntryPointNotFoundException: GdiplusStartup
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
  at System.Drawing.GDIPlus..cctor () [0x000cc] in /private/tmp/source-mono-mac-3.10.0-branch/bockbuild-mono-3.10.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.10.0/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs:127 
  --- End of inner exception stack trace ---
at System.Drawing.Image.InitFromStream (System.IO.Stream) [0x00077] in /private/tmp/source-mono-mac-3.10.0-branch/bockbuild-mono-3.10.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.10.0/mcs/class/System.Drawing/System.Drawing/Image.cs:290
at System.Drawing.Bitmap..ctor (System.IO.Stream,bool) [0x00006] in /private/tmp/source-mono-mac-3.10.0-branch/bockbuild-mono-3.10.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.10.0/mcs/class/System.Drawing/System.Drawing/Bitmap.cs:113
at System.Drawing.Bitmap..ctor (System.IO.Stream) [0x00000] in /private/tmp/source-mono-mac-3.10.0-branch/bockbuild-mono-3.10.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.10.0/mcs/class/System.Drawing/System.Drawing/Bitmap.cs:104
at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap..ctor (System.IO.Stream) <IL 0x0001a, 0x0006b>
at TestGDIPlus.MainWindowController.AwakeFromNib () [0x00020] in /Users/donblas/Downloads/TestGDIPlus 2/TestGDIPlus/MainWindowController.cs:55
at (wrapper dynamic-method) object.[TestGDIPlus.MainWindowController.Void AwakeFromNib()] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector) <IL 0x0000b, 0x0004d>
at (wrapper native-to-managed) object.[TestGDIPlus.MainWindowController.Void AwakeFromNib()] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector) <IL 0x0004f, 0x0011f>
at (wrapper managed-to-native) MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper (intptr,intptr) <0x00012>
at MonoMac.AppKit.NSWindowController.get_Window () [0x0003a] in /Users/builder/data/lanes/xamcore-lion-1.10-branch/2ff3e7b7/source/xamcore/src/build/compat/AppKit/NSWindowController.g.cs:430
at TestGDIPlus.MainWindowController.get_Window () [0x00002] in /Users/donblas/Downloads/TestGDIPlus 2/TestGDIPlus/MainWindowController.cs:44
at TestGDIPlus.AppDelegate.FinishedLaunching (MonoMac.Foundation.NSObject) [0x00012] in /Users/donblas/Downloads/TestGDIPlus 2/TestGDIPlus/AppDelegate.cs:20
at (wrapper dynamic-method) object.[TestGDIPlus.AppDelegate.Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject) <IL 0x00011, 0x00062>
at (wrapper native-to-managed) object.[TestGDIPlus.AppDelegate.Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject) <IL 0x0006c, 0x00183>
at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00012>
at MonoMac.AppKit.NSApplication.Main (string[]) [0x00041] in /Users/builder/data/lanes/xamcore-lion-1.10-branch/2ff3e7b7/source/xamcore/src/AppKit/NSApplication.cs:105
at TestGDIPlus.MainClass.Main (string[]) [0x00007] in /Users/donblas/Downloads/TestGDIPlus 2/TestGDIPlus/Main.cs:14

[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.EntryPointNotFoundException: GdiplusStartup
  at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
  at System.Drawing.GDIPlus..cctor () [0x000cc] in /private/tmp/source-mono-mac-3.10.0-branch/bockbuild-mono-3.10.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.10.0/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs:127 
  --- End of inner exception stack trace ---
at System.Drawing.Image.InitFromStream (System.IO.Stream) [0x00077] in /private/tmp/source-mono-mac-3.10.0-branch/bockbuild-mono-3.10.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.10.0/mcs/class/System.Drawing/System.Drawing/Image.cs:290
at System.Drawing.Bitmap..ctor (System.IO.Stream,bool) [0x00006] in /private/tmp/source-mono-mac-3.10.0-branch/bockbuild-mono-3.10.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.10.0/mcs/class/System.Drawing/System.Drawing/Bitmap.cs:113
at System.Drawing.Bitmap..ctor (System.IO.Stream) [0x00000] in /private/tmp/source-mono-mac-3.10.0-branch/bockbuild-mono-3.10.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.10.0/mcs/class/System.Drawing/System.Drawing/Bitmap.cs:104
at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap..ctor (System.IO.Stream) <IL 0x0001a, 0x0006b>
at TestGDIPlus.MainWindowController.AwakeFromNib () [0x00020] in /Users/donblas/Downloads/TestGDIPlus 2/TestGDIPlus/MainWindowController.cs:55
at (wrapper dynamic-method) object.[TestGDIPlus.MainWindowController.Void AwakeFromNib()] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector) <IL 0x0000b, 0x0004d>
at (wrapper native-to-managed) object.[TestGDIPlus.MainWindowController.Void AwakeFromNib()] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector) <IL 0x0004f, 0x0011f>
at (wrapper managed-to-native) MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper (intptr,intptr) <0x00012>
at MonoMac.AppKit.NSWindowController.get_Window () [0x0003a] in /Users/builder/data/lanes/xamcore-lion-1.10-branch/2ff3e7b7/source/xamcore/src/build/compat/AppKit/NSWindowController.g.cs:430
at TestGDIPlus.MainWindowController.get_Window () [0x00002] in /Users/donblas/Downloads/TestGDIPlus 2/TestGDIPlus/MainWindowController.cs:44
at TestGDIPlus.AppDelegate.FinishedLaunching (MonoMac.Foundation.NSObject) [0x00012] in /Users/donblas/Downloads/TestGDIPlus 2/TestGDIPlus/AppDelegate.cs:20
at (wrapper dynamic-method) object.[TestGDIPlus.AppDelegate.Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject) <IL 0x00011, 0x00062>
at (wrapper native-to-managed) object.[TestGDIPlus.AppDelegate.Void FinishedLaunching(MonoMac.Foundation.NSObject)] (MonoMac.Foundation.NSObject,MonoMac.ObjCRuntime.Selector,MonoMac.Foundation.NSObject) <IL 0x0006c, 0x00183>
at (wrapper managed-to-native) MonoMac.AppKit.NSApplication.NSApplicationMain (int,string[]) <0x00012>
at MonoMac.AppKit.NSApplication.Main (string[]) [0x00041] in /Users/builder/data/lanes/xamcore-lion-1.10-branch/2ff3e7b7/source/xamcore/src/AppKit/NSApplication.cs:105
at TestGDIPlus.MainClass.Main (string[]) [0x00007] in /Users/donblas/Downloads/TestGDIPlus 2/TestGDIPlus/Main.cs:14
Comment 1 Rodrigo Kumpera 2014-10-02 13:05:23 UTC
Hey Alexis,

This looks like a packaging bug. 

We did the following investigation.

With mono 3.8.0.
nm /Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib | grep GdiplusStartup
0000b5c0 T _GdiplusStartup


With mono 3.10.0.
nm /Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib | grep GdiplusStartup


So, 3.10 seems to be missing this symbol.

There are no changes in the libgdiplus hash between 3.8 and 3.10, so this comes from other changes in packaging.

Could you take a look at this?
Comment 2 Alexis Christoforides 2014-10-02 19:07:26 UTC
Hello,

This was almost certainly due to this missing commit on xamarin/bockbuild. Apologies, I thought I had brought it over from public:

https://github.com/xamarin/bockbuild/commit/99730f19809d262e5168d68498b311b2ce6c06dc

However I haven't been able to finish testing this as I'm having trouble reliably downloading the bockbuild packages from this connection.
Comment 3 Alexis Christoforides 2014-10-02 21:24:09 UTC
*** Bug 23471 has been marked as a duplicate of this bug. ***
Comment 4 narayanp 2014-10-03 06:21:57 UTC
I have checked this issue and I am able to reproduce this issue with Mono 3.10.0.18 and Xam.Mac 1.10.0.13/18

But this issue is fixed with Mono 3.10.0.20, I am able to run attached project with Mono 3.10.0.20 + Xam.Mac 1.10.0.13/18 successfully.

Screencast: 
http://www.screencast.com/t/yJuU6ZGAr5
http://www.screencast.com/t/WBS0wX84DEo

Hence, I am closing this issue.

But I am not able to change Bug status.
Comment 5 Brian Berry 2014-10-05 13:42:23 UTC
Note that it appears that 3.10.0.19 was pushed all the way to stable with this still active.  A primary reason for employing alpha/beta channels is to catch issues like these and provide adequate time for discovery + resolution.  It is probably worth doing a little process/timeline analysis here for future benefits.  At least two bugs were filed for the regression, so either (a) the alpha->beta->stable window was not large enough for these to arrive in due course, or (b) your promotion process does not first mandate the resolution of all active issues.  As it stands now, if this issue was truly only fixed in 3.10.0.20, those using stable and gdiplus services would be now forced into the alpha channel.   And we narrowly missed a condition where anyone using these features would be simply out of luck, no matter the channel.

Thanks for providing the fix ASAP---and have an excellent week at Evolve!
Comment 6 Boris Hajduk 2014-10-19 09:13:55 UTC
Not fixed on 3.10.0.20.

Downloaded & installed 3.10.0.20 from http://download.mono-project.com/archive/3.10.0/macos-10-x86/MonoFramework-MDK-3.10.0.20.macos10.xamarin.x86.pkg

nm /Library/Frameworks/Mono.framework/Versions/3.10.0/lib/libgdiplus.dylib |grep GdipCreateFrom
00008660 T _GdipCreateFromHDC
00008790 T _GdipCreateFromHWND
000087a0 T _GdipCreateFromXDrawable_linux

GdipCreateFromContext_macosx is missing
Comment 7 PJ 2014-10-20 12:10:50 UTC
*** Bug 23902 has been marked as a duplicate of this bug. ***
Comment 8 Akhilesh kumar 2014-10-20 12:23:13 UTC
On running command given in Comment 6, I observe that GdipCreateFromContext_macosx is missing. We are getting following output with Mono 3.10.0.20:

Jatin66s-iMac:lib jatin66$ nm libgdiplus.dylib | grep GdipCreateFrom
00008660 T _GdipCreateFromHDC
00008790 T _GdipCreateFromHWND
000087a0 T _GdipCreateFromXDrawable_linux
Comment 9 Eric Lawrence 2014-10-27 12:56:41 UTC
This appears to be causing Fiddler's Mono build to fail on startup as well.


webdev-lp:~ llbean$ mono --version
Mono JIT compiler version 3.10.0 ((detached/47db868 Thu Oct  2 22:04:39 EDT 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.4svn-mono-(detached/e656cac)
	GC:            sgen


MonoFiddler.log:

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) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.XplatUICarbon.PaintEventStart (System.Windows.Forms.Message& msg, IntPtr handle, Boolean client) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.XplatUI.PaintEventStart (System.Windows.Forms.Message& msg, IntPtr handle, Boolean client) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Label.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0
Comment 10 PJ 2014-11-07 16:20:36 UTC
This was fixed by Alexis.

BAD - Mono 3.10.0/e204655
GOOD - Mono 3.10.0/c4d7214

Diff of output of `nm /Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib` between BAD and GOOD:


  _.memset_pattern
  _BitSize
  _CFDictionaryGetValue
  _CFNumberGetValue
  _CFRelease
+ _CGBitmapContextCreateImage
+ _CGContextDrawImage
  _CGDisplayCurrentMode
  _CGDisplayIOServicePort
+ _CGImageRelease
  _CGMainDisplayID
  _DGifCloseFile
  _DGifGetExtension
@@ -135,9 +128,9 @@
  _GdipCreateFontFromHfontA
  _GdipCreateFontFromLogfontA
  _GdipCreateFontFromLogfontW
+ _GdipCreateFromContext_macosx
  _GdipCreateFromHDC
  _GdipCreateFromHWND
- _GdipCreateFromXDrawable_linux
  _GdipCreateHBITMAPFromBitmap
  _GdipCreateHICONFromBitmap
  _GdipCreateHatchBrush
@@ -655,8 +648,6 @@
  _TIFFSetWarningHandler
  _TIFFWriteDirectory
  _TIFFWriteScanline
- _XGetGeometry
- _XSetErrorHandler
  __DefaultRuneLocale
  ___CFConstantStringClassReference
  ___bzero
@@ -791,6 +782,8 @@
  _cairo_pattern_set_matrix
  _cairo_pattern_status
  _cairo_ps_surface_create
+ _cairo_quartz_surface_create
+ _cairo_quartz_surface_get_cg_context
  _cairo_rectangle
  _cairo_reset_clip
  _cairo_restore
@@ -831,7 +824,6 @@
  _cairo_text_extents
  _cairo_text_path
  _cairo_translate
- _cairo_xlib_surface_create
  _calloc
  _close$UNIX2003
  _convert_points
@@ -1188,7 +1180,6 @@
  _ico_mimetype
  _ico_sig_mask
  _ico_sig_pattern
- _ignore_error_handler
  _initCodecList
  _iround
  _jpeg_CreateCompress

Removed symbols have been reviewed and approved by Alexis. Marking as RESOLVED.

Note You need to log in before you can comment on or make changes to this bug.