From 30092db2366adba5877bac44cd6d36c0d87e99cc Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 18 Jul 2020 11:48:01 +0100 Subject: [PATCH] Update PngEncoder.cs --- src/ImageSharp/Formats/Png/PngEncoder.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ImageSharp/Formats/Png/PngEncoder.cs b/src/ImageSharp/Formats/Png/PngEncoder.cs index b0b4667de..61ea7c468 100644 --- a/src/ImageSharp/Formats/Png/PngEncoder.cs +++ b/src/ImageSharp/Formats/Png/PngEncoder.cs @@ -72,11 +72,13 @@ namespace SixLabors.ImageSharp.Formats.Png /// The to encode from. /// The to encode the image data to. /// A representing the asynchronous operation. - public Task EncodeAsync(Image image, Stream stream) + public async Task EncodeAsync(Image image, Stream stream) where TPixel : unmanaged, IPixel { - using var encoder = new PngEncoderCore(image.GetMemoryAllocator(), image.GetConfiguration(), new PngEncoderOptions(this)); - return encoder.EncodeAsync(image, stream); + using (var encoder = new PngEncoderCore(image.GetMemoryAllocator(), image.GetConfiguration(), new PngEncoderOptions(this))) + { + await encoder.EncodeAsync(image, stream).ConfigureAwait(false); + } } } }