Bug 8879 - Passing CGPDFInfo to UIGraphics.BeginPDFContext causes SIGSEGV
Summary: Passing CGPDFInfo to UIGraphics.BeginPDFContext causes SIGSEGV
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-12-11 01:46 UTC by Pierre-Andre van Leeuwen
Modified: 2012-12-12 01:14 UTC (History)
2 users (show)

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

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 Pierre-Andre van Leeuwen 2012-12-11 01:46:11 UTC
The following code causes a SIGSEGV: 
    var info = new CGPDFInfo()
        AllowsCopying = true,
        AllowsPrinting = true,
        Author = "My Name",// Setting any string property crashes
    UIGraphics.BeginPDFContext(file, RectangleF.Empty, info); 

The stack trace is as follows:
>at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr (intptr,intptr,intptr,intptr) <IL 0x00026, 0xffffffff>
>at MonoTouch.Foundation.NSMutableDictionary.LowlevelSetObject (MonoTouch.Foundation.NSObject,intptr) [0x00011] in /Developer/MonoTouch/Source/monotouch/src/shared/Foundation/NSMutableDictionary.cs:394
>at MonoTouch.CoreGraphics.CGPDFInfo.ToDictionary () [0x00033] in /Developer/MonoTouch/Source/monotouch/src/shared/CoreGraphics/CGContextPDF.cs:161
>at MonoTouch.UIKit.UIGraphics.BeginPDFContext (string,System.Drawing.RectangleF,MonoTouch.CoreGraphics.CGPDFInfo) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIGraphics.cs:99
Comment 1 Rolf Bjarne Kvinge [MSFT] 2012-12-11 08:25:30 UTC

maccore: 36ea6c1013c8bbd8ba40ca4892334bb6d1800530
mt master: f4c733ab71e60b47264aa08b8f77412e3a730fac
mt ios6: 185a3928929b296da36adb39b4edecf603044728
Comment 2 Rolf Bjarne Kvinge [MSFT] 2012-12-11 08:26:47 UTC
The next release with this fix will likely be 6.0.9 (another stable release is coming soon and it's too late to get into that stable release). I can get you a hotfix if you can't work around it in the meantime.
Comment 3 Pierre-Andre van Leeuwen 2012-12-11 08:34:46 UTC
Thanks for the quick response
Some code that demonstrates how to create an NSDictionary by hand and use that in stead of CGPDFInfo would be great. Could you point me in the right direction?
Comment 4 Rolf Bjarne Kvinge [MSFT] 2012-12-11 17:06:35 UTC
Here is the code that creates the NSDictionary from the CGPDFInfo: https://github.com/mono/maccore/blob/master/src/CoreGraphics/CGContextPDF.cs#L154 - it shouldn't be too hard to copy that and make it work in your own app.
Comment 5 Pierre-Andre van Leeuwen 2012-12-12 01:14:05 UTC
Thank you, it works! Your quick responses are really appreciated.