Skip to content

[IOS Xamarin] System.ExecutionEngineException: Attempting to JIT compile method 'void SixLabors.ImageSharp.Formats.Png.PngScanlineProcessor:ProcessRgbScanline<SixLabors.ImageSharp.PixelFormats.Rgba32> #1708

@MichielDG

Description

@MichielDG

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

In a xamarin forms for IOS project I'm using the method Image.Load to load a PNG image. I used it with imagedecoder and without but the same issue exists. The error I get is:

PngDecoderCore.ProcessDefilteredScanline[TPixel] (System.ReadOnlySpan`1[T] defilteredScanline, SixLabors.ImageSharp.ImageFrame`1[TPixel] pixels, SixLabors.ImageSharp.Formats.Png.PngMetadata pngMetadata)
System.ExecutionEngineException: Attempting to JIT compile method 'void 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://docs.microsoft.com/xamarin/ios/internals/limitations for more information.

Stack traces
SixLabors.ImageSharp.Formats.Png
PngDecoderCore.ProcessDefilteredScanline[TPixel] (System.ReadOnlySpan`1[T] defilteredScanline, SixLabors.ImageSharp.ImageFrame`1[TPixel] pixels, SixLabors.ImageSharp.Formats.Png.PngMetadata pngMetadata)
SixLabors.ImageSharp.Formats.Png
PngDecoderCore.DecodePixelData[TPixel] (System.IO.Compression.DeflateStream compressedStream, SixLabors.ImageSharp.ImageFrame`1[TPixel] image, SixLabors.ImageSharp.Formats.Png.PngMetadata pngMetadata)
SixLabors.ImageSharp.Formats.Png
PngDecoderCore.ReadScanlines[TPixel] (SixLabors.ImageSharp.Formats.Png.PngChunk chunk, SixLabors.ImageSharp.ImageFrame`1[TPixel] image, SixLabors.ImageSharp.Formats.Png.PngMetadata pngMetadata)
SixLabors.ImageSharp.Formats.Png
PngDecoderCore.Decode[TPixel] (SixLabors.ImageSharp.IO.BufferedReadStream stream, System.Threading.CancellationToken cancellationToken)
SixLabors.ImageSharp.Formats
ImageDecoderUtilities.Decode[TPixel] (SixLabors.ImageSharp.Formats.IImageDecoderInternals decoder, SixLabors.ImageSharp.Configuration configuration, System.IO.Stream stream, System.Func`3[T1,T2,TResult] largeImageExceptionFactory)
SixLabors.ImageSharp.Formats
ImageDecoderUtilities.Decode[TPixel] (SixLabors.ImageSharp.Formats.IImageDecoderInternals decoder, SixLabors.ImageSharp.Configuration configuration, System.IO.Stream stream)
SixLabors.ImageSharp.Formats.Png
PngDecoder.Decode[TPixel] (SixLabors.ImageSharp.Configuration configuration, System.IO.Stream stream)
SixLabors.ImageSharp.Formats.Png
PngDecoder.Decode (SixLabors.ImageSharp.Configuration configuration, System.IO.Stream stream)
SixLabors.ImageSharp
Image.Decode (System.IO.Stream stream, SixLabors.ImageSharp.Configuration config)
SixLabors.ImageSharp
Image+<>c__DisplayClass137_0.<Load>b__0 (System.IO.Stream s)
SixLabors.ImageSharp
Image.WithSeekableStream[T] (SixLabors.ImageSharp.Configuration configuration, System.IO.Stream stream, System.Func`2[T,TResult] action)
SixLabors.ImageSharp
Image.Load (SixLabors.ImageSharp.Configuration configuration, System.IO.Stream stream, SixLabors.ImageSharp.Formats.IImageFormat& format)
SixLabors.ImageSharp
Image.Load (SixLabors.ImageSharp.Configuration configuration, System.Byte[] data, SixLabors.ImageSharp.Formats.IImageFormat& format)
SixLabors.ImageSharp
Image.Load (System.Byte[] data, SixLabors.ImageSharp.Formats.IImageFormat& format)

Steps to Reproduce

Use an IOS Xamarin project and execute the following code:

byte[] imageData; // fill this with a png
var imageDecoder = new SixLabors.ImageSharp.Formats.Png.PngDecoder();
var image = Image.Load(imageData, imageDecoder);
  • ImageSharp version: 1.0.3
  • Environment (Operating system, version and so on): IOS 14.5
  • .NET Standard: 2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions