PlatformNotSupportedException from Image.Load on server
cmeeren opened this issue · comments
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
andRELEASE
mode - I have searched open and closed issues to ensure it has not already been reported
ImageSharp version
3.1.1 and 3.1.0
Other ImageSharp packages and versions
None
Environment (Operating system, version and so on)
Windows Server 2016 Datacenter, Intel Xeon Gold 6134, 64-bit
.NET Framework version
.NET 8
Description
When loading data using Image.Load
on a server with ImageSharp >= 3.1.0, I get the exception below. It works fine in my local computer, and it works fine on the server with ImageSharp 3.0.2. Only from 3.1.0 and above does it fail on the server.
Unhandled exception. System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Runtime.Intrinsics.X86.Ssse3.Abs(Vector128`1 value)
at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.DecodePixelData[TPixel](FrameControl frameControl, DeflateStream compressedStream, ImageFrame`1 imageFrame, PngMetadata pngMetadata, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.ReadScanlines[TPixel](Int32 chunkLength, ImageFrame`1 image, PngMetadata pngMetadata, Func`1 getData, FrameControl& frameControl, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.Decode[TPixel](BufferedReadStream stream, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.ImageDecoderUtilities.Decode[TPixel](IImageDecoderInternals decoder, Configuration configuration, Stream stream, Func`3 largeImageExceptionFactory, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.ImageDecoderUtilities.Decode[TPixel](IImageDecoderInternals decoder, Configuration configuration, Stream stream, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.Png.PngDecoder.Decode[TPixel](PngDecoderOptions options, Stream stream, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.Png.PngDecoder.Decode(PngDecoderOptions options, Stream stream, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.SpecializedImageDecoder`1.Decode(DecoderOptions options, Stream stream, CancellationToken cancellationToken)
at SixLabors.ImageSharp.Formats.ImageDecoder.<>c__DisplayClass1_0.<Decode>b__0(Stream s)
at SixLabors.ImageSharp.Formats.ImageDecoder.<WithSeekableStream>g__PeformActionAndResetPosition|11_0[T](Stream s, Int64 position, <>c__DisplayClass11_0`1&)
at SixLabors.ImageSharp.Formats.ImageDecoder.WithSeekableStream[T](DecoderOptions options, Stream stream, Func`2 action)
at SixLabors.ImageSharp.Formats.ImageDecoder.Decode(DecoderOptions options, Stream stream)
at SixLabors.ImageSharp.Image.Decode(DecoderOptions options, Stream stream)
at SixLabors.ImageSharp.Image.<>c__DisplayClass80_0.<Load>b__0(Stream s)
at SixLabors.ImageSharp.Image.WithSeekableStream[T](DecoderOptions options, Stream stream, Func`2 action)
at SixLabors.ImageSharp.Image.Load(DecoderOptions options, Stream stream)
at SixLabors.ImageSharp.Image.Load(DecoderOptions options, ReadOnlySpan`1 buffer)
at SixLabors.ImageSharp.Image.Load(ReadOnlySpan`1 buffer)
at <StartupCode$ImageSharpTest>.$Foo.main@() in C:\Users\cmeer\Source\Repos\ImageSharpTest\ImageSharpTest\Program.fs:line 7
Steps to Reproduce
Please see the attached repro solution. I am publishing it using this command:
dotnet publish ImageSharpTest -c Release -r win-x64 --self-contained -o out
For reference, the repro solution contains a trivial/minimal project file and this Program.fs
file:
open System
open SixLabors.ImageSharp
let data = "..." // 56665 characters omitted here
data |> Convert.FromBase64String |> Image.Load |> ignore<Image>
printfn "OK"
Images
No response
I don’t think this is a regression. There have been no changes to the scan line decoding code across those versions.
As mentioned, using the trivial repro, it works when referencing 3.0.2 and does not work when referencing 3.1.0 or 3.1.1. Isn't that the definition of a regression?
Actually, you're correct. I broke it 7 months ago.
PR opened
And fix released.