简体   繁体   中英

Attempting to JIT compile method exception in MonoTouch.CoreGraphics.CGContext.DrawPDFPage

Here is the stack

System.ExecutionEngineException: Attempting to JIT compile method '(wrapper managed-to-native) MonoTouch.CoreGraphics.CGContext:CGContextDrawPDFPage (intptr,intptr)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

at MonoTouch.CoreGraphics.CGContext.DrawPDFPage (MonoTouch.CoreGraphics.CGPDFPage page) [0x00000] in :0 at Neva.PdfViewer.PageContentView.Draw (MonoTouch.CoreGraphics.CGContext context) [0x00000] in :0 at Neva.PdfViewer.PageContentTile.DrawInContext (MonoTouch.CoreGraphics.CGContext ctx) [0x00000] in :0 [7.1.1]

While we were not able to recreate this problem in QA or unit testing, this exception randomly happens on AppStore distributed installations.

Looking at DrawPDFPage in CGContext

    public void DrawPDFPage (CGPDFPage page)
    {
        CGContext.CGContextDrawPDFPage (this.handle, page.handle);
    }

where CGContextDrawPDFPage is a P/Invoke function

    [DllImport ("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics")]
    private static extern void CGContextDrawPDFPage (IntPtr c, IntPtr page);

doesn't give us any hint. The link above http://docs.xamarin.com/ios/about/limitations is not really helpful.

My question is, what could be causing such an exception? What are steps to debug and fix it?

This exception (System.ExecutionEngineException: Attempting to JIT compile method ...) should be 100% reproducible.

The fact that it isn't, points at something else (and probably worse): memory corruption of some sort.

However without some way to (at least randomly) reproduce it yourself, it's close to impossible to track down.

My initial suggestion would be to try to figure out if there's anything at all you can figure out in order to be able to create a test case yourself:

  • Does it only occur for a certain set of devices (only iPad 2 for instance)?
  • Does it only occur for a certain set of customers (only customers in Iceland for instance)?
  • Is the exception exactly the same every time, or does the P/Invoke / stack trace vary?
  • Is it a low-memory condition? Did the app get memory warnings prior to this occurring?
  • Are there any required steps in your app (ie if the user does X+Y it may crash, but if he does Y+X, then it never crashes)?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM