DEBUG and RELEASE modeAttempting to download a specific image to stream via an HttpClient and then loading it via Image.Load<Rgba32>() throws the following exception:
SixLabors.ImageSharp.ImageFormatException: PNG Image does not contain a data chunk
This is the first time this has ever occurred in my code, the exact method I have used to download and load images has never thrown this exception for the hundreds or maybe thousands of other images I and other users have used which called this method. I have asked a few friends to attempt to test this as well, and one other person did and did not report any issues, which makes this even stranger.
// ignore lack of using statements, I omitted them
var url = "https://cdn.discordapp.com/emojis/598551803566489611.png?v=1"
var response = await new HttpClient().GetAsync(url);
var stream = await response.Content.ReadAsStreamAsync();
var image = Image.Load<Rgba32>(stream); // throws on this line
Both downloading the image in a web browser AND writing stream directly to file produce a clean PNG image with what looks to be intact data chunks when opened with a tool like TweakPNG:

(I have essentially no knowledge of PNG headers, data chunks, etc, so if something here looks wrong then I do apologize. Take my knowledge with a grain of salt.)
v1.0.0-unstable0806v1.0.0-unstable0421See the comment in #1029
https://github.com/SixLabors/ImageSharp/issues/1029#issuecomment-544061230
The decoder is waiting for the end of the stream which remains open. You should be using your stream.
using var stream = await response.Content.ReadAsStreamAsync();
Hello, thank you for the response.
I noted in the comments that I omitted my using statements as I was pasting a simplified version of the code. Here is the actual code as it is used:
using var response = await Http.GetAsync(url);
if (response.StatusCode == HttpStatusCode.NotFound)
{
return CommandErrorLocalized("emojiparser_notfound");
}
await using var stream = await response.Content.ReadAsStreamAsync();
using var image = Image.Load<Rgba32>(stream);
Ah right.... The HttpClient bit is a red herring. Looks like we're unable to decode that png, I suspect because of the presence of the unhandled bkGD chunk
I'll see if I can get a fix out asap.