Skip to content

ImageSharp produces a corrupted image on .NET 6 Preview 6 #55866

@kerams

Description

@kerams

Description

Originally reported in SixLabors/ImageSharp#1704.

Loading a PNG file and immediately saving it as Jpeg works as expected on .NET 5. However when I switch to net6.0 in the csproj, only the top part of the image appears in the output jpeg file, the rest is black.

Steps to Reproduce

Create s console C# application and reference ImageSharp 1.0.3. First run this with net5.0 in the csproj, then compare the result to net6.0.

using SixLabors.ImageSharp;
using System.IO;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            using var img = Image.Load("unknown.png");
            var fs = File.OpenWrite("unknown.jpeg");
            img.SaveAsJpeg(fs);
            fs.Flush();
            fs.Close();
        }
    }
}

Use this image
https://user-images.githubusercontent.com/5063478/126033585-4efb31ce-c231-4229-8412-68fb73950ffc.png

The result on 5.0.400-preview.21277.10 looks like the original image.

The result on 6.0.100-preview.6.21355.2 looks like this
https://user-images.githubusercontent.com/5063478/126033623-0f886133-bc0d-4449-8048-d5d29a0e377c.jpeg

Configuration

dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.100-preview.6.21355.2 Commit: 7f8e0d76c0

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100-preview.6.21355.2\

Host (useful for support):
Version: 6.0.0-preview.7.21318.2
Commit: 1401202

.NET SDKs installed:
5.0.400-preview.21277.10 [C:\Program Files\dotnet\sdk]
6.0.100-preview.6.21355.2 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.6.21355.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.6.21352.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0-preview.6.21353.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Regression?

Yes, works on 5.0.400-preview.21277.10.

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