1

I am trying to create a thumbnail image of pdf in Monotouch but the app crashes sometimes and throws below error.

Stacktrace:

at MonoTouch.CoreFoundation.CFString.Dispose () [0x00000] in /Developer/MonoTouch/Source/monotouch/src/shared/CoreFoundation/CFString.cs:131
at MonoTouch.CoreFoundation.CFUrl.FromFile (string) [0x00048] in /Developer/MonoTouch/Source/monotouch/src/shared/CoreFoundation/CFUrl.cs:79 at MonoTouch.CoreGraphics.CGPDFDocument.FromFile (string) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/shared/CoreGraphics/CGPDFDocument.cs:98

Below is my code to generate the thumbnail image and they're inside of BackgroundWorker thread. The weird thing is that it does not happen always. Does anybody have idea why this is happening? Thanks in advance.

try
{
    CGPDFDocument pdfDoc = CGPDFDocument.FromFile(url);
    if (pdfDoc != null)
    {
        CGPDFPage pdfPage = pdfDoc.GetPage(1);
        if (pdfPage != null)
        {
            UIImage image = PDFConverter.TransformToImage(pdfPage, this.Frame.Width);
        }
    }
}
catch (Exception ex)
{
    Console.WriteLine("BookmarkView - BookmarkView: {0}", ex.ToString());
}
jlordo
  • 37,490
  • 6
  • 58
  • 83
j2brian703
  • 23
  • 3
  • Could you file a bug report (http://bugzilla.xamarin.com) and attach the symbolicated crash report. It will have more details (e.g. about what the other threads are doing). – poupou May 03 '13 at 18:25
  • The stack trace does not correspond to the above bit of code. It references CFUrl, but your snippet does not have that – miguel.de.icaza May 04 '13 at 14:51
  • CGPDFDocument pdfDoc = CGPDFDocument.FromFile(url); is the line where it references CFUrl and CFUrl references CFString. – j2brian703 May 11 '13 at 15:32

0 Answers0