Skip to content

Load a png on IOS causes an "Attempting to JIT compile method while running in aot-only mode" #776

@vicfergar

Description

@vicfergar

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

Description

When trying to load a PNG image on iOS 12 an unhandled exception is raised.

Steps to Reproduce

On an Xamarin.IOS project try to invoke:
var image = SixLabors.ImageSharp.Image.Load(stream);

The next exception will be raised:

System.ExecutionEngineException: Attempting to JIT compile method 'SixLabors.ImageSharp.Formats.Png.PngScanlineProcessor:ProcessRgbScanline<SixLabors.ImageSharp.PixelFormats.Rgba32> (SixLabors.ImageSharp.Configuration,SixLabors.ImageSharp.Formats.Png.PngHeader&,System.ReadOnlySpan`1<byte>,System.Span`1<SixLabors.ImageSharp.PixelFormats.Rgba32>,int,int,bool,SixLabors.ImageSharp.PixelFormats.Rgb48,SixLabors.ImageSharp.PixelFormats.Rgb24)' while running in aot-only mode. See https://developer.xamarin.com/guides/ios/advanced_topics/limitations/ for more information.

  at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.ProcessDefilteredScanline[TPixel] (System.ReadOnlySpan`1[T] defilteredScanline, SixLabors.ImageSharp.ImageFrame`1[TPixel] pixels) [0x000db] in <eb47c90af2ba451c9c07fe98c40e7810>:0 
  at (wrapper unknown) System.Object.gsharedvt_in()
  at (wrapper unknown) System.Object.gsharedvt_out()
  at SixLabors.ImageSharp.Formats.Png.
PngDecoderCore.DecodePixelData[TPixel] (System.IO.Stream compressedStream, SixLabors.ImageSharp.ImageFrame`1[TPixel] image) [0x000e5] in <eb47c90af2ba451c9c07fe98c40e7810>:0 
  at (wrapper unknown) System.Object.gsharedvt_in()
  at (wrapper unknown) System.Object.gsharedvt_out()
  at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.ReadScanlines[TPixel] (System.IO.Stream dataStream, SixLabors.ImageSharp.ImageFrame`1[TPixel] image) [0x00017] in <eb47c90af2ba451c9c07fe98c40e7810>:0 
  at (wrapper unknown) System.Object.gsharedvt_in()
  at (wrapper unknown) System.Object.gsharedvt_out()
  at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.Decode[TPixel] (System.IO.Stream stream) [0x00171] in <eb47c90af2ba451c9c07fe98c40e7810>:0 
  at (wrapper unknown) System.Object.gsharedvt_in()
  at (wrapper unknown) System.Object.gsharedvt_out()
  at SixLabors.ImageSharp.Formats.Png.PngDecoder.Decode[TPixel] (SixLabors.ImageSharp.Configuration configuration, System.IO.Stream stream) [0x00008] in <eb47c90af2ba451c9c07fe98c40e78
10>:0 
  at SixLabors.ImageSharp.Image.Decode[TPixel] (System.IO.Stream stream, SixLabors.ImageSharp.Configuration config) [0x00015] in <eb47c90af2ba451c9c07fe98c40e7810>:0 
  at SixLabors.ImageSharp.Image+<>c__DisplayClass55_0`1[TPixel].<Load>b__0 (System.IO.Stream s) [0x00000] in <eb47c90af2ba451c9c07fe98c40e7810>:0 
  at SixLabors.ImageSharp.Image.WithSeekableStream[T] (SixLabors.ImageSharp.Configuration config, System.IO.Stream stream, System.Func`2[T,TResult] action) [0x0002b] in <eb47c90af2ba451c9c07fe98c40e7810>:0 
  at SixLabors.ImageSharp.Image.Load[TPixel] (SixLabors.ImageSharp.Configuration config, System.IO.Stream stream, SixLabors.ImageSharp.Formats.IImageFormat& format) [0x00022] in <eb47c90af2ba451c9c07fe98c40e7810>:0 
  at SixLabors.ImageSharp.Image.Load[TPixel] (SixLabors.ImageSharp.Configuration config, System.IO.Stream stream) [0x00000] in <eb47c90af2ba451c9c07fe98c40e7810>:0 
  at SixLabors.ImageSharp.Image.Load[TPixel] (System.IO.Stream stream) [0x00000] in <eb47c90af2ba451c9c07fe98c40e78
10>:0 
  at SixLabors.ImageSharp.Image.Load (System.IO.Stream stream) [0x00000] in <eb47c90af2ba451c9c07fe98c40e7810>:0 

System Configuration

  • ImageSharp version: 1.0.0-beta0005
  • Other ImageSharp packages and versions: (none)
  • Environment (Operating system, version and so on): iOS 12
  • .NET Framework version:
  • Additional information:
    === Visual Studio Enterprise 2017 for Windows ===
    Version 15.8.9
    VisualStudio.15.Release/15.8.9+28010.2050
    Xamarin 4.11.0.779 (d15-8@ff915e800)
    Xamarin.iOS and Xamarin.Mac SDK 12.1.0.15 (cbfb047)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions