Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
ConfigureAwait(false) everything!
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Aug 20, 2020
1 parent 0aa1935 commit 6fd2a6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Xamarin.Essentials/Screenshot/Screenshot.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ internal async Task<Stream> PlatformOpenReadAsync(ScreenshotFormat format)
_ => Bitmap.CompressFormat.Png,
};

await bmp.CompressAsync(f, 100, stream);
await bmp.CompressAsync(f, 100, stream).ConfigureAwait(false);
stream.Position = 0;

return stream;
Expand Down
8 changes: 4 additions & 4 deletions Xamarin.Essentials/Screenshot/Screenshot.uwp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static async Task<ScreenshotResult> PlatformCaptureAsync()
throw new InvalidOperationException("Unable to find main window content.");

var bmp = new RenderTargetBitmap();
await bmp.RenderAsync(element);
await bmp.RenderAsync(element).AsTask().ConfigureAwait(false);

return new ScreenshotResult(bmp);
}
Expand All @@ -44,7 +44,7 @@ internal async Task<Stream> PlatformOpenReadAsync(ScreenshotFormat format)
{
if (bytes == null)
{
var pixels = await bmp.GetPixelsAsync();
var pixels = await bmp.GetPixelsAsync().AsTask().ConfigureAwait(false);
bytes = pixels.ToArray();
}

Expand All @@ -56,9 +56,9 @@ internal async Task<Stream> PlatformOpenReadAsync(ScreenshotFormat format)

var ms = new InMemoryRandomAccessStream();

var encoder = await BitmapEncoder.CreateAsync(f, ms);
var encoder = await BitmapEncoder.CreateAsync(f, ms).AsTask().ConfigureAwait(false);
encoder.SetPixelData(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Ignore, (uint)bmp.PixelWidth, (uint)bmp.PixelHeight, 96, 96, bytes);
await encoder.FlushAsync();
await encoder.FlushAsync().AsTask().ConfigureAwait(false);

return ms.AsStreamForRead();
}
Expand Down

0 comments on commit 6fd2a6a

Please sign in to comment.