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

[Android] CollectionView Crashes when ItemSource Changed #5110

Closed
minaairsupport opened this Issue Feb 1, 2019 · 5 comments

Comments

6 participants
@minaairsupport
Copy link

minaairsupport commented Feb 1, 2019

Description

App Crash when ItemSource Changed for CollectionView

Steps to Reproduce

  1. Create ContentPage contain CollectionView
  2. init item source for CollectionView with an empty list
  3. Load data from web service and make any delay then fill this ItemSource

Expected Behavior

ItemSource Changed

Actual Behavior

App Crashes with this error

JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args)
Java.Lang.IllegalStateException: Observer md51558244f76c53b6aeda52c8a337f2c37.DataChangeObserver@e23f401 was not registered.

Basic Information

  • Version with issue: 4.0.0.94569-pre3
  • Last known good version:
  • IDE: Visual Studio Mac 2017 , 2019
  • Platform Target Frameworks:
    • Android: 7.0
  • Nuget Packages:4.0.0.94569-pre3
  • Affected Devices:Nexsus 4 , Android 7.0 api 24
@kingces95

This comment has been minimized.

Copy link
Member

kingces95 commented Feb 4, 2019

Can you please attach a reproduction? I'm guessing how and where the delay is injected will affect whether this reproduces.

@kingces95 kingces95 moved this from New to Needs Info in Triage Feb 4, 2019

@paymicro paymicro self-assigned this Feb 6, 2019

@samhouts samhouts added this to In Progress in vNext (4.0.0) Feb 6, 2019

@rubenglam

This comment has been minimized.

Copy link

rubenglam commented Feb 7, 2019

Same error 👍 . I have a searchView that filters the items and when there are 0 items, just after modify the query to that it contains items the app crash with the same error.

@samhouts samhouts removed this from In Progress in vNext (4.0.0) Feb 7, 2019

@samhouts samhouts added this to In Progress in vCurrent (3.6.0) Feb 7, 2019

@samhouts samhouts removed this from Needs Info in Triage Feb 7, 2019

@samhouts samhouts moved this from In Progress to Done in vCurrent (3.6.0) Feb 25, 2019

@davidbritch

This comment has been minimized.

Copy link
Collaborator

davidbritch commented Mar 13, 2019

@kingces95 I've been able to repro this in 4.0-pre5. Setting the ItemsSource property after a 2 second delay causes a crash:

        protected override async void OnAppearing()
        {
            base.OnAppearing();

            await Task.Delay(2000);
            collectionView.ItemsSource = (BindingContext as MonkeysViewModel).Monkeys;
        }

I tried all kinds of threading options, and marshalling to the UI thread (when appropriate) and it always happens.

Repro steps

  1. Run the attached sample (either iOS or Android).
  2. Browse to the EmptyViewLoadSimulationPage.
  3. Wait 2 seconds.

Actual result

Sample crashes.

Expected result.

Sample updates the CollectionView from an ObservableCollection.

Repro link

CollectionViewDemos.zip

iOS Crash

MonoTouchException:

Screen Shot 2019-03-13 at 14 31 33

Android crash

IllegalStateException:

Screen Shot 2019-03-13 at 14 34 29

@davidbritch

This comment has been minimized.

Copy link
Collaborator

davidbritch commented Mar 15, 2019

@hartez I've retried this on 3.6 and 4.0-pre6 and the results are identical for both. On iOS a MonoTouchException occurs, as per the screenshot above. On Android it works fine.

artemkalinovsky added a commit to artemkalinovsky/GiphyBrowser that referenced this issue Mar 19, 2019

@hartez

This comment has been minimized.

Copy link
Member

hartez commented Apr 15, 2019

This crash is fixed for Android in 4.0.0-pre6 and for iOS in 4.0.0-pre8.

@hartez hartez closed this Apr 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.