jamesmontemagno / ImageCirclePlugin

Circle Images for your Xamarin.Forms Applications
MIT License
240 stars 68 forks source link

Image source map or update throws exception in case with ImageSource.FromStream - Android #33

Closed pavalamf closed 6 years ago

pavalamf commented 7 years ago

Attached stack on gist - https://gist.github.com/pavalamf/43fea9e8b469d59df8a67ec467ae03ee#file-gistfile1-txt

Bug Information

Version Number of Plugin: 1.8.1 Device Tested On:21 Jun 2017 Simulator Tested On:NA Version of VS: 2015 U3 Version of Xamarin: 2.3.3.175 Versions of other things you are using:

Steps to reproduce the Behavior

Scenario 1:

  1. Mapped image from PCL image on Form load
  2. Async method to update image resource from stream pulled from service

Scenario 2: Async method to map image resource from stream pulled from service

Scenario 3:

  1. Mapped image from PCL image on Form load
  2. Async method to update image resource from byte array pulled from service and mapped using memory stream to isolate the stream lock.

Expected Behavior

Image should be updated to image source from Stream

Actual Behavior

Throws exception and crashes the app though written the code under Try Catch Block

Code snippet

private async Task UpdateImageSource() { var proPic = (CircleImage)ProfilePicLayout.Children[0]; try { var stream = await ViewModel.GetProfilePicSteam(); if (stream != null) proPic.Source = ImageSource.FromStream(() => new MemoryStream(stream)); } catch (Exception ex) { } finally { } }

Screenshotst

NA - App crashes

jamesmontemagno commented 7 years ago

What happens if you do this on just an "Image" and not a "CircleImage".

jamesmontemagno commented 6 years ago

All loading of images comes from XF, please report there.