Skip to content

.Net 5.0 RC-1 breaks ImageSharp #1356

@lofcz

Description

@lofcz

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

I've encountered a strange bug when mutating images after migrating mvc app from net fw48 to net5 rc1. I've swapped to async image handling. Steps I do (async action on a controller):

1) await HttpContext.Request.ReadFormAsync()
2) Image<Rgba32> img = Image.Load<Rgba32>([first image from form].OpenReadStream(), out IImageFormat imgFormat);
3) await img.SaveAsync("some path"); // saves the image correctly
4) img.Mutate(x => x.Resize(w, h, s)); // thumbnail; used Bicubic, tried Lancoz3 to check if that could be the problem
5) await img.SaveAsync("thumbnail path");

// also tried alternative
5) await using FileStream stream = System.IO.File.Create("some path");
6) await img.SaveAsync(stream, imgFormat);

Extremely frustrating is that this is happening only on production, not on my local machine. I've tried to use another sampler and use latest dev build of ImageSharp, neither helped. In each and every case the first half of an image is mutated correctly, while the other is either blank or filled with artifacts. I'm clueless about how should I move forward, the only option so far would be to go back to sync processing of images which I'd very much like to avoid. Attaching some test images:

Saved thumbnail 1:

a8f3fce0-c6ec-4e4b-a304-ae381301f9ef_thumbnail (1)

Saved non-mutated image 1:

a8f3fce0-c6ec-4e4b-a304-ae381301f9ef

Saved thumbnail 2:

803238f6-8248-4df7-ac73-a0f36840295a_thumbnail

Saved non-mutated image 2:

803238f6-8248-4df7-ac73-a0f36840295a

Saved thumbnail 3:

bc54f22d-1ae8-4135-ad38-3f3e761767f4_thumbnail

Saved non-mutated image 3:

bc54f22d-1ae8-4135-ad38-3f3e761767f4

System Configuration

  • dev: windows 10 20206_rsprerelease, net5 rc1
  • production: windows server 2016 datacenter 10.0.14393, net5 rc1

ImageSharp version:

  • tried 1.1, then 1.0.2 alpha 7

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