Bug 56478 - Xamarin ListView - CachingStrategy="RecycleElement" Crashing in Android
Summary: Xamarin ListView - CachingStrategy="RecycleElement" Crashing in Android
Status: RESOLVED NORESPONSE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-05-15 19:40 UTC by Kamesh Pareek
Modified: 2017-06-17 21:41 UTC (History)
3 users (show)

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


Attachments
Error Log (609.07 KB, text/plain)
2017-05-15 19:40 UTC, Kamesh Pareek
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 NORESPONSE

Description Kamesh Pareek 2017-05-15 19:40:10 UTC
Created attachment 22177 [details]
Error Log

Hi,

I am using list view in my Xamarin Farm application.  My App is crashing when I scroll down for number of items in Android.  Everything works fine in iOS and I am not having any performance issue that I know.  I am on the latest stable channel.  Also find attached log file.

This issue happen when I use CachingStrategy="RecycleElement".  If I change that to RetainElement app works fine.  Here is my XAML code from List View Page:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:HFHS.PCL"
             x:Class="HFHS.PCL.Pages.PCLListViewPage"
             xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" 
             xmlns:fftransformations="clr-namespace:FFImageLoading.Transformations;assembly=FFImageLoading.Transformations" 
             x:Name="pclListPage" 
             >

    <ContentPage.Resources>
        <ResourceDictionary>
            <local:StaffTypeConverter x:Key="stafftypeCvt" />
            <local:BackgroundConverter x:Key="backgroundCvt" />
        </ResourceDictionary>
    </ContentPage.Resources>
    <ContentPage.ToolbarItems>
    </ContentPage.ToolbarItems>
    <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">
        <SearchBar x:Name="searchBar" AutomationId="searchBar" Placeholder="Refine Search Results..." TextChanged="SearchBar_OnTextChanged"></SearchBar>
        <ListView x:Name="PCLListView" 
              CachingStrategy="RecycleElement"
              SeparatorColor="Transparent"
              HasUnevenRows="False"
              IsGroupingEnabled="True"
              GroupDisplayBinding="{Binding Key}"
              GroupShortNameBinding="{Binding Key}"
              RowHeight="60" 
              ItemTapped="ItemTapped" 
              ItemsSource="{Binding PCLContactlist}"
              >
            <ListView.FooterTemplate>
                <DataTemplate>
                    <ContentView Padding="0,10,20,0">
                        <Label x:Name="footer" FontSize="Micro"
                       Text="{Binding ., StringFormat='{0} contacts'}" 
                       VerticalTextAlignment="Center" HorizontalTextAlignment="End" />
                    </ContentView>
                </DataTemplate>
            </ListView.FooterTemplate>
            <ListView.HeaderTemplate>
                <DataTemplate>
                    <ContentView Padding="0,10,30,0">
                        <Label x:Name="header" FontSize="Micro"
                       Text="{Binding ., StringFormat='{0} contacts'}" 
                       VerticalTextAlignment="Center" HorizontalTextAlignment="End" />
                    </ContentView>
                </DataTemplate>
            </ListView.HeaderTemplate>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell StyleId="disclosure" Height="60">
                        <StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="Black">
                        <StackLayout Orientation="Horizontal" 
                                     Spacing="0" 
                                     VerticalOptions="FillAndExpand"
                                     HorizontalOptions="FillAndExpand"
                                     BackgroundColor="{Binding StaffType, Converter={StaticResource backgroundCvt}}"
                                     Margin="0,0,0,0.4"
                                     >
                                <ContentView Margin="2,1,0,0" WidthRequest="50">
                                    <ffimageloading:CachedImage 
                                    HorizontalOptions="Center" 
                                    VerticalOptions="Center" 
                                    CacheDuration="30"  
                                    RetryCount="3"
                                    RetryDelay="60"
                                    WidthRequest="50"
                                    HeightRequest="50" 
                                    DownsampleToViewSize="true"  
                                    Source="{Binding SmallPhotoUrl}"  
                                    LoadingPlaceholder="placeholderProfileImage.png">
                                    </ffimageloading:CachedImage>
                                </ContentView>
                                <ContentView Margin="2,1,0,0" >
                                    <StackLayout >
                                        <Grid RowSpacing="0" >
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="*" />
                                                <RowDefinition Height="*" />
                                                <RowDefinition Height="*" />
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="190" />
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <Label Text="{Binding DisplayFirstNameFirst}" HeightRequest="18" VerticalTextAlignment="Start" LineBreakMode="TailTruncation" Grid.Row="0" Grid.Column="0" />
                                            <Label Text="{Binding Credentials}" HeightRequest="16"  VerticalOptions="EndAndExpand" HorizontalOptions="EndAndExpand"  TextColor="Black" FontSize="Micro" LineBreakMode="TailTruncation" Grid.Row="0" Grid.Column="1" />
                                            <Label Text="{Binding Specialties}" HeightRequest="7" VerticalTextAlignment="Start" FontSize="Micro" LineBreakMode="TailTruncation" Grid.Row="1" Grid.Column="0" />
                                            <Label Text="{Binding ContactLocations}" HeightRequest="7" VerticalTextAlignment="Start" FontSize="Micro" LineBreakMode="TailTruncation" Grid.Row="2" Grid.Column="0" />
                                            <Label Text="{Binding StaffType, Converter={StaticResource stafftypeCvt}}" HeightRequest="7" VerticalTextAlignment="Start" FontSize="Micro" LineBreakMode="TailTruncation" Grid.Row="2" Grid.Column="1" />
                                        </Grid>
                                    </StackLayout>
                                </ContentView>
                            </StackLayout>
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>
</ContentPage>
Comment 1 Paul DiPietro [MSFT] 2017-05-15 19:56:36 UTC
Hi, we can't do much with the code pasted because it relies upon too much external code. Please upload a reproduction project with the minimal amount of code necessary to reproduce the issue, making certain that it is cleaned with the bin/obj folders removed to reduce the size. If you haven't tested against the prerelease version, that may be worth doing so as well to see if the issue still exists. Thanks!
Comment 2 David Ortinau [MSFT] 2017-06-17 21:41:41 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket and attach a working project that demonstrates the issue. Thanks!