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

App crash on button click in CollectionView Item #17707

Closed
HobDev opened this issue Sep 28, 2023 · 10 comments
Closed

App crash on button click in CollectionView Item #17707

HobDev opened this issue Sep 28, 2023 · 10 comments
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView high It doesn't work at all, crashes or has a big impact. platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-attention Issue has more information and needs another look t/bug Something isn't working

Comments

@HobDev
Copy link

HobDev commented Sep 28, 2023

Description

There are two buttons in a CollectionView ItemTemplate. Starangely the app crashes on clicking the first button. But strangely the app does not crash on clicking the second button.

Steps to Reproduce

Run the reproduction app. Try Clicking on the buttons in one of the CollectionView items.

Link to public reproduction project repository

https://github.com/HobDev/DotNet8MauiBugs/tree/CollectionViewDataIssue

Version with bug

8.0.0-rc.1.9171

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

7.0.92

Affected platforms

Windows

Affected platform versions

Windows SDK 10.0.19041.0

Did you find any workaround?

NO

Relevant log output

No response

@HobDev HobDev added the t/bug Something isn't working label Sep 28, 2023
@drasticactions
Copy link
Contributor

The error is

Message = "Parameter \"parameter\" (object) cannot be of type DotNet8MauiBugs.MainViewModel, as the command type requires an argument of type DotNet8MauiBugs.Venue. (Parameter 'parameter')"

So it's trying to pass in the View Model itself and not the parameter.

It actually throws when the app first runs before you click on it when it's initializing during "CanExecute" if you enable showing all exceptions. Trying it in MAUI net7.0, it does work. It throws in net8.0.

The big issue I see debugging this is that you're using two CommunityToolkit libraries, C# Markup and MVVM (For AsyncCommand, Relay, etc). While the same versions of those work with net7.0, I'm not sure if those have any influence into this and if they could be part of the problem you're having. It could be the binding API in C# Markup has a problem, or the AsyncCommand from MVVM is at fault? Or MAUI itself is passing in the wrong parameter. It's hard to tell based on how this is written.

If you could rewrite your code to only use pure MAUI APIs and can reproduce the issue (you don't have to use XAML, it can still be done in C#), that would help a lot.

@samhouts samhouts added platform/windows 🪟 area-controls-collectionview CollectionView, CarouselView, IndicatorView high It doesn't work at all, crashes or has a big impact. potential-regression This issue described a possible regression on a currently supported version., verification pending labels Sep 28, 2023
@samhouts samhouts added this to the .NET 8 GA milestone Sep 28, 2023
@samhouts samhouts added the s/needs-repro Attach a solution or code which reproduces the issue label Sep 28, 2023
@ghost
Copy link

ghost commented Sep 28, 2023

Hi @HobDev. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@nor0x
Copy link
Contributor

nor0x commented Sep 28, 2023

same!
Here is a repro
#11956 (comment)

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Sep 28, 2023
@samhouts
Copy link
Member

@nor0x I see you're also using the CommunityToolkit. Does it repro without that?

@samhouts samhouts added s/needs-info Issue needs more info from the author and removed s/needs-attention Issue has more information and needs another look labels Sep 28, 2023
@ghost
Copy link

ghost commented Sep 28, 2023

Hi @HobDev. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@PureWeen
Copy link
Member

@HobDev
Copy link
Author

HobDev commented Sep 29, 2023

@PureWeen I added https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json in the Package Sources and Package Source Mapping of the Visual Studio 17.8.0 Preview 2.0. What should I do next to work with the nightly builds.

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Sep 29, 2023
@HobDev
Copy link
Author

HobDev commented Sep 29, 2023

@drasticactions I can confirm that that removing CommunityToolkit.Mvvm code resolves the issue. Can this issue be moved to the communitytoolkit repo.

While testing the code without CommunityToolkit.Mvvm and CommunityToolkit.Maui.Markup I catch another two bugs in the CollectionView which are reported here and here.

@nor0x
Copy link
Contributor

nor0x commented Sep 29, 2023

@nor0x I see you're also using the CommunityToolkit. Does it repro without that?

will check that today 👍

EDIT:
i can now confirm that the crash doesn't occur without the CommunityToolkit - the root cause is probably somehwere in there

@samhouts
Copy link
Member

samhouts commented Oct 9, 2023

This issue was moved to xamarin/XamarinCommunityToolkit#1989

@dotnet dotnet locked and limited conversation to collaborators Oct 9, 2023
@samhouts samhouts removed this from the .NET 8 GA milestone Oct 9, 2023
@samhouts samhouts closed this as completed Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView high It doesn't work at all, crashes or has a big impact. platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-attention Issue has more information and needs another look t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants