Bug 46847 - UIBezierPath.Stroke() in conjunction with UIGraphicsPDFRenderer.CreatePDF() crashes
Summary: UIBezierPath.Stroke() in conjunction with UIGraphicsPDFRenderer.CreatePDF() c...
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: XI 10.0 (iOS10)
Hardware: PC Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Alex Soto [MSFT]
Depends on:
Reported: 2016-11-12 02:17 UTC by Larry O'Brien
Modified: 2017-01-03 17:25 UTC (History)
2 users (show)

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

Stack trace (14.93 KB, text/plain)
2016-11-12 02:17 UTC, Larry O'Brien
Program demonstrating error (2.34 KB, application/octet-stream)
2016-11-12 02:19 UTC, Larry O'Brien
Xcode Repro (29.26 KB, application/zip)
2016-11-28 06:13 UTC, Alex Soto [MSFT]

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 Developer Community or GitHub 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:

Description Larry O'Brien 2016-11-12 02:17:54 UTC
Created attachment 18436 [details]
Stack trace

The following code leads to a crash:

var r = new UIGraphicsPdfRenderer (new CGRect (0, 0, 100, 100), UIGraphicsPdfRendererFormat.DefaultFormat);
NSData pdf = r.CreatePdf ((UIGraphicsPdfRendererContext ctxt) =>
UIColor.Red.SetFill ();
UIColor.Black.SetStroke ();

var path = new UIBezierPath ();
path.MoveTo (new CGPoint (10, 10));
path.AddLineTo (new CGPoint (90, 10));
path.AddLineTo (new CGPoint (45, 90));
path.ClosePath ();
path.Stroke (); //<-- Crash occurs here
path.Fill ();

The same code works as expected with a UIGraphicsImageRenderer. I believe it is valid drawing code even though this is a PDF. (?) 

I have attached the stack trace. I could only get the stack trace by running on a device; trying to run the code in Workbooks or on a Simulator.
Comment 1 Larry O'Brien 2016-11-12 02:19:11 UTC
Created attachment 18437 [details]
Program demonstrating error

The crash occurs at line 55: path.Stroke();
Comment 2 Alex Soto [MSFT] 2016-11-28 06:13:04 UTC
Created attachment 18685 [details]
Xcode Repro

Hello Larry, I have been able to reproduce the same crash in Objective-C so this is definitely not our bug, I do not know much about drawing pdfs so it is either a bug in apple sdks or we are missing something else.

Will you continue investigating? or are you ok if I close this bug?

Comment 3 Alex Soto [MSFT] 2017-01-03 17:25:20 UTC
Closing since I am confident this is not our bug. Cheers!