Image inside SfAccordian fails second time

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);


1 Reply 1 reply marked as answer

LN Lakshmi Natarajan Syncfusion Team May 14, 2021 04:11 AM UTC

Hi Alan, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported query “Image inside SfAccordian fails second time” from our side. We would like to inform you that we could not reproduce the reported scenario at our side. We have checked our sample using custom images and attached the tested sample in the following link, 
 
 
Also, we suggest you to use the converter to change the image when expand/collapse. Please find our documentation regarding customizing the HeaderIcon in SfAccordion from the following link, 
KB links:  
 
Please check our sample and let us know if you still facing the same issue? If not, please modify our sample based on your requirement and revert us back with the following details, 
  • Share Accordion code snippets
  • Share Device configuration details
  • Share issue reproducing video
  • Share Syncfusion and Xamarin.Forms version
 
It will be helpful for us to check on it and provide you the solution as soon as possible. 
 
Lakshmi Natarajan 
 


Marked as answer
Loader.
Up arrow icon