question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] ListView crash in preview 5 on Android and Windows

See original GitHub issue

Description

The following ListView in MAUI preview 5 crashes on Android and WinUI (but it works on iOS):

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:MauiApp3"
             x:Class="MauiApp3.MainPage">
    <StackLayout Margin="20">
        <ListView>
            <ListView.ItemsSource>
                <x:Array Type="{x:Type local:Person}">
                    <local:Person Name="Dave" Age="21" />
                    <local:Person Name="Ed" Age="50" />
                </x:Array>
            </ListView.ItemsSource>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <Grid ColumnDefinitions="Auto,Auto">
                            <Label Text="{Binding Name}"
                                   TextColor="Black" />
                            <Label Grid.Column="1"
                                   Text="{Binding Age}"
                                   TextColor="Black"
                                   HorizontalTextAlignment="End" />
                        </Grid>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </StackLayout>
</ContentPage>

Steps to Reproduce

  1. Run the attached sample on Android or WinUI.

Expected Behavior

A ListView displays two rows of data.

Actual Behavior

Android: ListView displays for ~2s before the app terminates. Windows: UnhandledException (object not set to an instance of an object).

Basic Information

  • Version with issue: 6.0.100-preview.5.794
  • Last known good version: N/A
  • IDE: VS2019 16.11 P2
  • Platform Target Frameworks:
    • Android: API 30
    • Win: net6.0-windows10.0.19041

Reproduction Link

MauiApp3.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Daniellledcommented, Jun 18, 2021

I also am seeing this on Windows but with MAUI Preview 4.634.

0reactions
PureWeencommented, Mar 4, 2022

Closing this for now. I wasn’t able to reproduce with the attached project on P14

Read more comments on GitHub >

github_iconTop Results From Across the Web

ListView ItemsSource refreshing problems in Windows and ...
On Android having 1 object shown then adding another and showing both will crash the app, same if you first show 5 and...
Read more >
updated visual studio xamarin to 16.9.1 and now my ...
updated visual studio xamarin to 16.9.1 and now my ListView continuously updates its self till it crashes the app.
Read more >
Nexus 5 with latest android 5 preview- App crashing during ...
Issue 431280: Nexus 5 with latest android 5 preview- App crashing during webview reload · 1. Take Android Cordova application · 2. In...
Read more >
Large set of data in listview crashing the android app
Hi I need to manage the large set of data in Listview in android app. The list items may be around 250 or...
Read more >
Hot Reload freezes VS Mac with virtualized ListViews
The issue is this: if you have Hot Reload with Changes Only mode and a virtualized ListView in the screen (XF 5+), thousands...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found