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 27160 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 9888 [details]
Solution to reproduce GDI exception.
Sample code from our PrintDocument.PrintPage event handler:
void HandlePrintPage (object sender, PrintPageEventArgs e)
var g = e.Graphics;
g.DrawLine (new System.Drawing.Pen (System.Drawing.Brushes.Black), 0, 0, 300, 0);
This will predictably throw the following exception on Yosemite:
System.Exception: Generic Error [GDI+ status: GenericError]
at System.Drawing.GDIPlus.CheckStatus (Status status) [0x0007a] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs:217
at System.Drawing.Graphics.DrawLine (System.Drawing.Pen pen, Single x1, Single y1, Single x2, Single y2) [0x00057] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/System.Drawing/System.Drawing/Graphics.cs:1035
at (wrapper remoting-invoke-with-check) System.Drawing.Graphics:DrawLine (System.Drawing.Pen,single,single,single,single)
Please note that this exception does NOT occur on Mavericks, so something in Yosemite clearly broke the framework. Attached is a sample project that will reproduce the exception. It is coded against our receipt printer (Star Micronics TSP100), so you will likely have to tweak.
This is an active production issue that is currently affecting our Mac client base who have upgraded to Yosemite.
System.Drawing is not Xamarin.Mac. I've moved this to the mono class libraries section.
What version of mono are you using? Are you using one that you got from Xamarin Studio? An old version of mono was mispackaged and causing issue.
However, since it only happens on Yosemite, unless only that machine has the "bad" mono, it is probably an implementation issue.
I've attempted with Mono 3.10 and 3.12 that came with Xamarin, and also attempted using 220.127.116.11 which Cody provided me earlier. All of them produced the same exception.
Currently using GTK# as a workaround for printing, and that seems to be doing the job for the time being.