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

CollectionView Crash when clearing & adding data second time. #7343

Closed
jamesmontemagno opened this issue May 19, 2022 · 7 comments
Closed

CollectionView Crash when clearing & adding data second time. #7343

jamesmontemagno opened this issue May 19, 2022 · 7 comments
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working
Milestone

Comments

@jamesmontemagno
Copy link
Member

Description

See: dotnet-presentations/dotnet-maui-workshop#49

Steps to Reproduce

1.) Open https://github.com/dotnet-presentations/dotnet-maui-workshop "Finish folder"
2.) Launch on iOS
3.) Load monkeys
4.) Load Monkeys again -> crash

Version with bug

Release Candidate 3 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS and possibly Mac (all versions)

Did you find any workaround?

not yet ;(

Relevant log output

No response

@jamesmontemagno jamesmontemagno added t/bug Something isn't working s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels May 19, 2022
@Eilon Eilon added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label May 19, 2022
@VincentBu
Copy link

I fail to retrieve data from https://www.montemagno.com/monkeys.json, so I comment your Online code and use the offline part.
not repro with vs main build(32519.297.main)

@VincentBu VincentBu added s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels May 20, 2022
@michaelstonis
Copy link

I believe this is the same issue I experienced here: #7237

@PureWeen PureWeen added this to the 6.0-sr2 milestone Jun 8, 2022
@yairp03
Copy link

yairp03 commented Jun 20, 2022

Happened to me too, but only in a Grouped CollectionView

@yairp03
Copy link

yairp03 commented Jun 20, 2022

A possible workaround is to use an ObservableProperty on a regular List and replace the entire object with each update, instead of using an ObservableCollection.
For example:

[INotifyPropertyChanged]
public partial class MainViewModel
{
    [ObservableProperty]
    List<Monkey> monkeys = new();

    [RelayCommand]
    void ReloadMonkeys()
    {
        List<Monkey> newMonkeys = Monkeys is null ? new() : new(Monkeys);
        newMonkeys.Add(new("A1"));
        newMonkeys.Add(new("A2"));
        newMonkeys.Add(new("A3"));

        Monkeys = newMonkeys;
    }
}

instead of:

public partial class MainViewModel
{
    public ObservableCollection<Monkey> Monkeys { get; } = new();

    [RelayCommand]
    void ReloadMonkeys()
    {
        Monkeys.Add(new("A1"));
        Monkeys.Add(new("A2"));
        Monkeys.Add(new("A3"));
    }
}

@hartez hartez added the fatal label Jun 27, 2022
@hartez hartez modified the milestones: 6.0-sr2, 6.0-sr3 Jun 27, 2022
@samhouts samhouts added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Jul 12, 2022
@hartez hartez removed the fatal label Aug 1, 2022
@mattleibow mattleibow modified the milestones: 6.0-sr3, 6.0-servicing Aug 29, 2022
@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@samhouts samhouts removed the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label Oct 14, 2022
@samhouts samhouts removed the s/verified Verified / Reproducible Issue ready for Engineering Triage label Apr 5, 2023
@Zhanglirong-Winnie Zhanglirong-Winnie added s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version labels May 9, 2023
@ghost
Copy link

ghost commented May 9, 2023

Hi @jamesmontemagno. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

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.

@Zhanglirong-Winnie
Copy link

Verified this issue with Visual Studio Enterprise 17.6.0 Preview 6.0, Not repro on iOS platform with above project.
dotnet-maui-workshop-main.zip
Crash

@ghost ghost closed this as completed May 16, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jun 15, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst s/triaged Issue has been reviewed s/try-latest-version Please try to reproduce the potential issue on the latest public version t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests