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 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.
MT 4.2 beta
CGPDFArray.GetDictionary() returns a CGPDFArray as output instead of a CGPDFDictionary, as it is in ObjC:
CGPDFArrayRef pageAnnotations = NULL;
CGPDFDictionaryRef pageDictionary = CGPDFPageGetDictionary(_PDFPageRef);
CGPDFDictionaryGetArray(pageDictionary, "Annots", &pageAnnotations);
CGPDFDictionaryRef annotationDictionary = NULL;
// Here the output is correct: CGPDFDictionaryRef
CGPDFArrayGetDictionary(pageAnnotations, index, &annotationDictionary);
In Monotouch it is:
CGPDFArray.GetDictionary(int idx, out CGPDFArray result)
CGPDFArray.GetDictionary(int idx, out CGPDFDictionary result)
In the mean time (and as a workaround until a fixed version is released) you can use something like below in your own application by using the CGPDFArray.Handle property for the first parameter.
extern static bool CGPDFArrayGetDictionary (IntPtr handle, IntPtr idx, out IntPtr result);
public bool GetDictionary (IntPtr handle, int idx, out CGPDFDictionary result)
var r = CGPDFArrayGetDictionary (handle, (IntPtr) idx, out res);
result = null;
result = new CGPDFDictionary (res);
Fixed in a2b400bc84f9d24bac2ec0829814e504ad1c8178 (master).
Thanks for the report!
Is there a way to get access to a build of this? I don't really care if it is pre-alpha - I just assume you didn't break lots of other things! :-)
Meanwhile I have used a workaround exactly as you proposed and it works just fine.
I backported this fix to our monotouch-4.2 branch (along with Miguel's CGPDFDictionary.Apply patch) so they'll both be available in future (post 4.2.1) versions. I'll attach a newer monotouch.dll to the this bug report later today so you can use it on top of 4.2.1.
Created attachment 460 [details]
assembly w/pdf related fixes
First wait until you have monotouch 4.2.1 installed (less likely to break things)
Then backup /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll and /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll.mdb
Next copy the attachment over /Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll
Rebuild your code and it should be ok
note #1: once you update MonoTouch to 4.2.2+ it will overwrite this assembly - but since the fixes are both in 'master' and 'monotouch-4.2' branches then it should not affect you.
note #2: if you run into weird errors please re-install the original (backup) assembly (and symbols) before reporting the bug to ensure we'll work on the same code base as you to duplicate any issue :-)