Hello,
I 'm trying to display an Image inside and accordion item. It works fine the first time the view is rendered. However, the next time throws an exception:
System.ObjectDisposedException
Message=Cannot access a closed Stream.
I'm getting a stream to the image here:
public static async Task<Stream> GetStreamAsync(string fullPathName)
{
MemoryStream returnStream = new MemoryStream();
try
{
if (File.Exists(fullPathName))
{
await File.OpenRead(fullPathName).CopyToAsync(returnStream);
returnStream.Position = 0;
}
}
catch (Exception)
{
throw;
}
return returnStream;
}
and then assigning it to the Image:
Stream aStream = await GetStreamAsync(aPath);
TheImageSource = Xamarin.Forms.ImageSource.FromStream(() => aStream);