Bug 23539 - Databound ImageSource property within ListView ItemTemplate: renders duplicate images / missing images
Summary: Databound ImageSource property within ListView ItemTemplate: renders duplicat...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-10-01 18:36 UTC by Leo Olivers
Modified: 2014-11-10 12:11 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
repro case solution (5.78 MB, application/octet-stream)
2014-10-01 18:37 UTC, Leo Olivers
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Leo Olivers 2014-10-01 18:36:05 UTC
Put a Xamarin.Forms.Image inside a ViewCel within a DataTemplate.

Assign the datatemplate containing the Image to a ListView's ItemTemplate.

Bind the Image's Source property to a .png byte array in a viewmodel, using a value converter that converts the byte array to an ImageSource.

Bind the ListView's ItemsSource to an observable collection of image viewmodels.  The viewmodels are created only once for the duration of the app and the image byte arrays within are loaded once into memory and do not change.

Put the ListView on a ContentPage and repeatedly navigate to that ContentPage and back.

--> Observe how the ListView renders the images inconsistently:
    -sometimes it duplicates an image in multiple rows
    -sometimes it does not render one or more of the images at all
    -sometimes it renders the images successively on top of each other in rapid succession

reproduced on Android Emulator 4.1, Galaxy Note 3
Comment 1 Leo Olivers 2014-10-01 18:37:16 UTC
Created attachment 8279 [details]
repro case solution
Comment 2 Leo Olivers 2014-10-01 18:47:04 UTC
Note: this is on Android! IOS/WP was not tested.
Comment 3 Sadik Ali 2014-10-03 02:57:12 UTC
I have checked this issue and able to reproduce this issue. To reproduce this issue I have followed the sample application and instruction provided in bug description.

Steps to reproduce:

1. Open attached sample application in VS
2. Build the application it will build successfully
3. Deploy the application on simulator, it deploy successfully 
5. It will show message and instruction with button 
4. Click on Button and Repeatedly navigate to that ContentPage and back
5. Observe How the ListView renders the images inconsistently:
  a.Sometimes it duplicates an image in multiple rows
  b.Sometimes it does not render one or more of the images at all
  c.Sometimes it renders the images successively on top of each other in    rapid succession

Additional Information: Getting same behavior on device too (Samsung Galaxy s4).

Screencast: http://www.screencast.com/t/JL0qSJkBNG

Environment Info:
Microsoft Visual Studio Professional 2012
Version 11.0.50727.1 RTMREL
Microsoft .NET Framework
Version 4.5.50938

Installed Version: Professional

LightSwitch for Visual Studio 2012   04938-004-0033001-02367
Microsoft LightSwitch for Visual Studio 2012

Office Developer Tools   04938-004-0033001-02367
Microsoft Office Developer Tools

Team Explorer for Visual Studio 2012   04938-004-0033001-02367
Microsoft Team Explorer for Visual Studio 2012

Visual Basic 2012   04938-004-0033001-02367
Microsoft Visual Basic 2012

Visual C# 2012   04938-004-0033001-02367
Microsoft Visual C# 2012

Visual C++ 2012   04938-004-0033001-02367
Microsoft Visual C++ 2012

Visual F# 2012   04938-004-0033001-02367
Microsoft Visual F# 2012

Visual Studio 2012 Code Analysis Spell Checker   04938-004-0033001-02367
Microsoft® Visual Studio® 2012 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Visual Studio 2012 SharePoint Developer Tools   04938-004-0033001-02367
Microsoft Visual Studio 2012 SharePoint Developer Tools

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

NuGet Package Manager   2.0.30625.9003
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.0
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   11.1.20627.00
Microsoft SQL Server Data Tools

Web Developer Tools   1.0.30710.0
Microsoft Web Developer Tools contains the following components:
Page Inspector: Tool that offers an efficient way to decompose Web Applications and diagnose front-end issues.
Web Publishing: Extensions required for Web Publishing for both hosted servers as well as on premises.
Web Form Templates: Includes the default templates for Web Form Applications.
Editor Extensions: Includes HTML, CSS, and JS editor extensions that greatly enhance the development experience.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.6.262.0 (21b7dba8736246dfd10e3f19a92ed68f1b30abfd)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.16.0.17 (2a7b68212b17c903160fbd8e0106babb299d1be3)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.0.66.0 (3e201c8aa14879773f966f483329bcda49fd3a41)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 4 Jason Smith [MSFT] 2014-10-20 21:47:14 UTC
Fixed in 1.3.0-pre1 (not released yet)
Comment 6 Dominic N [MSFT] 2014-11-10 12:11:26 UTC
A customer experiencing this issue has indicated that implementing an image cache and loading the images from file with:

ImageSource.FromFile (file.Path);

Allows him to work around the issue. This should be useful to those hitting the error while we're waiting for the release of 1.3.0.