Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListView shows two items on one line and crashes when clicking (windows) #21981

Open
adegeo opened this issue Apr 22, 2024 · 2 comments
Open
Labels
area-controls-listview ListView and TableView platform/windows 🪟 s/triaged Issue has been reviewed t/bug Something isn't working
Milestone

Comments

@adegeo
Copy link

adegeo commented Apr 22, 2024

Description

The ListView control bound with a data set seems to create repeat the first item in the collection under the second. When that item is clicked, an unhandled exception is raised:

This collection cannot work with indices larger than Int32.MaxValue - 1 (0x7FFFFFFF - 1). (Parameter 'index')

Stack trace

   at ABI.System.Collections.IList.ToAbiHelper.EnsureIndexInt32(UInt32 index, Int32 listCapacity)
   at ABI.System.Collections.IList.ToAbiHelper.GetAt(UInt32 index)
   at ABI.System.Collections.IList.Vftbl.Do_Abi_GetAt_0(IntPtr thisPtr, UInt32 index, IntPtr* result)

Versions tested

  • VS 17.9.6
  • VS 17.10.0 Preview 4

The project seems to work usually on the first run, or after you delete the bin/obj folders. Any other run after that causes the error to happen. However, I've noticed it happens on and off. I can run 3 times no corrupted list, then the next 4 times are the error, then it's back to working, etc.

image

Here's a video of it in action

maui_error.mp4

Steps to Reproduce

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:vm="clr-namespace:MovieCatalog.ViewModels"
             xmlns:local="clr-namespace:MovieCatalog"
             x:Class="MovieCatalog.Views.MoviesListPage"
             x:DataType="vm:MovieListViewModel"
             Title="Movies"
             BindingContext="{x:Static local:App.MainViewModel}">
    <Grid Margin="10">
        <ListView ItemsSource="{Binding Movies}" ItemTapped="ListView_ItemTapped">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <TextCell Text="{Binding Title}" x:DataType="vm:MovieViewModel">
                        <TextCell.ContextActions>
                            <MenuItem Text="Delete" IsDestructive="True" />
                        </TextCell.ContextActions>
                    </TextCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </Grid>
</ContentPage>

Link to public reproduction project repository

https://github.com/adegeo/mauibugs_1

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 11 23H2 22631.3447

Did you find any workaround?

No

Relevant log output

No response

@adegeo adegeo added the t/bug Something isn't working label Apr 22, 2024
@kevinxufei kevinxufei added s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels Apr 23, 2024
@kevinxufei
Copy link

Verified this issue with Visual Studio 17.10.0 Preview 4/17.9.6(8.0.20&8.0.3), Deploying to windows machine multiple times, can not repro this issue.

@adegeo
Copy link
Author

adegeo commented Apr 23, 2024

Is there something I should do to try and get logs? I can repo this constantly. Also, half the time deploying windows I just get a blank window with no content, the same color as the title bar. That bug has been happening for at least a year.

@dotnet-policy-service dotnet-policy-service bot removed the s/try-latest-version Please try to reproduce the potential issue on the latest public version label Apr 23, 2024
@PureWeen PureWeen added the area-controls-listview ListView and TableView label Apr 23, 2024
@jsuarezruiz jsuarezruiz added this to the Backlog milestone Jun 4, 2024
@samhouts samhouts removed the s/triaged Issue has been reviewed label Jul 3, 2024
@samhouts samhouts added the s/triaged Issue has been reviewed label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-listview ListView and TableView platform/windows 🪟 s/triaged Issue has been reviewed t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants