Skip to content

ImageSharp breaks with .NET 6 RC-1 #1768

@klogeaage

Description

@klogeaage

Prerequisites

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

Description

I have an issue with running ImageSharp with .NET 6 RC-1, where code that has been running for more than a year, has started to fail consistently after updating from .NET 5.0. It happens when resizing certain rather small images that originate from PNG images on the iPhone. Either the output image is corrupted or I get an ImageFormatException: Bad method for ZLIB header: cmf=50.

The stacktrace is:

SixLabors.ImageSharp.ImageFormatException:
   at SixLabors.ImageSharp.Formats.Png.Zlib.ZlibInflateStream.InitializeInflateStream (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.ReadScanlines (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Formats.Png.PngDecoderCore.Decode (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Formats.ImageDecoderUtilities.Decode (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Formats.ImageDecoderUtilities.Decode (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Formats.Png.PngDecoder.Decode (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Formats.Png.PngDecoder.Decode (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Image.Decode (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Image+<>c__DisplayClass137_0.<Load>b__0 (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Image.WithSeekableStream (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Image.Load (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Image.Load (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at SixLabors.ImageSharp.Image.Load (SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13)
   at JourneyDoc.API.Services.ImageProcessor.AutoOrient (JourneyDoc.API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: D:\Source\Repos\JourneyDoc\JourneyDoc.API\Services\ImageProcessor.cs:46)

This feels a bit like déjà vu as I was involved in reporting and reproducing this issue with .NET 5.0 RC-1 last year.

Steps to Reproduce

I'm hoping that your existing test suite may exhibit the same problem if you run it against the latest .NET 6 Release Candidate. If not, I will try to create a reproduction test program.

System Configuration

  • ImageSharp version: 1.0.3
  • Other ImageSharp packages and versions: N/A
  • Environment (Operating system, version and so on): Windows Server in Azure
  • .NET Framework version: 6.0 RC-1
  • Additional information:

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