xamarin / SignaturePad

MIT License
245 stars 150 forks source link

Xamarin Forms iOS - GetImageStreamAsync causes app to hang #158

Open lachlanedmiston opened 5 years ago

lachlanedmiston commented 5 years ago

Description

Awaiting GetImageStreamAsync causes the app to hang forever.

Code

Xaml:

Extension method in shared project that gets the image: public static async Task ToBytes(this SignaturePadView @this) { var settings = new SignaturePad.Forms.ImageConstructionSettings() { BackgroundColor = Xamarin.Forms.Color.White, DesiredSizeOrScale = new SizeOrScale(600, 300, SizeOrScaleType.Scale, true) }; using (var stream = await @this.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Png, settings)) using (var memoryStream = new MemoryStream()) { stream.CopyTo(memoryStream); return memoryStream.ToArray(); } } ### Expected Behavior GetImageStreamAsync to return the image contents or error out. ### Actual Behavior GetImageStreamAsync never returns and the app UI locks up. ### Basic Information - Version with issue: 3.0.0 - Last known good version: not known - IDE: Visual Studio Community 15.9.9 - Platform Target Frameworks: - iOS: 12.1 - Xamarin.Forms: 3.6.0.220655 - Target Devices: - iPhone emulator