ClearCachedViews

10 posts, 0 answers
  1. DMITRIY
    DMITRIY avatar
    3 posts
    Member since:
    Feb 2019

    Posted 10 Jul 2019 Link to this post

    Hi. When i close this page, I get a NullReferenceException. Appeared after upgrading to 4.0. If I use ListView, then the problem disappears. If I will not add children to baseGrid, then the problem disappears. Please, help me.


    using App.Models.ModelsJsonForMethods;
    using System;
    using System.Collections.ObjectModel;
    using Telerik.XamarinForms.DataControls;
    using Telerik.XamarinForms.DataControls.ListView;
    using Xamarin.Forms;
    using Xamarin.Forms.Xaml;

    namespace App.Views
    {
        [XamlCompilation(XamlCompilationOptions.Compile)]
        public partial class Page1 : ContentPage
        {
            RadListView listView;
            ObservableCollection<ImportanceInfo> listInfo = new ObservableCollection<ImportanceInfo>();
            public Page1()
            {
                InitializeComponent();
                Refresh();
            }
            private void Refresh()
            {
                listView = new RadListView
                {
                    ItemsSource = listInfo,
                    ItemTemplate = new DataTemplate(() =>
                    {
                        Label stageLabel = new Label();
                        stageLabel.HorizontalOptions = LayoutOptions.Center;
                        stageLabel.VerticalOptions = LayoutOptions.Center;
                        stageLabel.Margin = new Thickness(15, 0, 0, 0);
                        stageLabel.FontSize = 18;
                        stageLabel.SetBinding(Label.TextProperty, new Binding(nameof(ImportanceInfo.StatusName)));
                        Label briefInformationLabel = new Label();
                        briefInformationLabel.HorizontalOptions = LayoutOptions.Start;
                        briefInformationLabel.VerticalOptions = LayoutOptions.Center;
                        briefInformationLabel.FontSize = 18;
                        briefInformationLabel.SetBinding(Label.TextProperty, new Binding(nameof(ImportanceInfo.CommentText)));
                        Label dateLabel = new Label();
                        dateLabel.HorizontalOptions = LayoutOptions.Center;
                        dateLabel.VerticalOptions = LayoutOptions.Center;
                        dateLabel.FontSize = 18;
                        dateLabel.SetBinding(Label.TextProperty, new Binding(nameof(ImportanceInfo.DateSession)));
                        Grid grid = new Grid
                        {
                            RowDefinitions =
                            {
                                    new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
                            },
                            ColumnDefinitions =
                            {
                                    new ColumnDefinition { Width = new GridLength(0.3, GridUnitType.Star) },
                                    new ColumnDefinition { Width = new GridLength(0.5, GridUnitType.Star) },
                                    new ColumnDefinition { Width = new GridLength(0.2, GridUnitType.Star) },
                            },
                            ColumnSpacing = 3,
                            RowSpacing = 3
                        };
                        grid.Children.Add(stageLabel, 0, 0);
                        grid.Children.Add(briefInformationLabel, 1, 0);
                        grid.Children.Add(dateLabel, 2, 0);
                        return new ListViewTemplateCell
                        {
                            View = grid
                        };
                    })
                };
                StackLayout layout = new StackLayout
                {
                    Spacing = 0
                };
                Grid baseGrid = new Grid
                {
                    RowDefinitions =
                                {
                                    new RowDefinition { Height = 56 },
                                },
                    ColumnDefinitions =
                                {
                                    new ColumnDefinition { Width = new GridLength(0.3, GridUnitType.Star) },
                                    new ColumnDefinition { Width = new GridLength(0.5, GridUnitType.Star) },
                                     new ColumnDefinition { Width = new GridLength(0.2, GridUnitType.Star) }
                    }
                };
                baseGrid.Children.Add(new Label { Text = "Stage" }, 0, 0);
                baseGrid.Children.Add(new Label { Text = "Info" }, 1, 0);
                baseGrid.Children.Add(new Label { Text = "Date" }, 2, 0);
                layout.Children.Add(baseGrid);
                layout.Children.Add(listView);
                ImportanceInfo x = new ImportanceInfo();
                x.CommentText = "111";
                x.ShortText = "222";
                x.Unid = "000";
                x.StatusName = "333";
                x.DateSession = DateTime.Now.ToString();
                listInfo.Add(x);
                this.Content = layout;
            }
        }
    }

     

    StackTrace:

      at Xamarin.Forms.Platform.Android.PageRenderer.Xamarin.Forms.Platform.Android.IOrderedTraversalController.UpdateTraversalOrder () [0x000ea] in <9392e6d0fb4f4401a79989cd08844170>:0 
      at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].UpdateParentPageTraversalOrder () [0x00025] in <9392e6d0fb4f4401a79989cd08844170>:0 
      at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00116] in <9392e6d0fb4f4401a79989cd08844170>:0 
      at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
      at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:211 
      at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:353 
      at Xamarin.Forms.Element.set_Parent (Xamarin.Forms.Element value) [0x00094] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:210 
      at Xamarin.Forms.Element.OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:335 
      at Xamarin.Forms.ViewCell.set_View (Xamarin.Forms.View value) [0x00019] in D:\a\1\s\Xamarin.Forms.Core\Cells\ViewCell.cs:25 
      at Telerik.XamarinForms.DataControlsRenderer.Android.ListView.CellContainerBase.Dispose (System.Boolean disposing) [0x00034] in <aace7404487f477ba4b06b1a101e6de8>:0 
      at Java.Lang.Object.Dispose () [0x00000] in <ff9f3f3d4e134974a889db1b532c9b6e>:0 
      at Telerik.XamarinForms.DataControlsRenderer.Android.FormsListViewDataSourceAdapterBase.ClearCachedViews () [0x00023] in <aace7404487f477ba4b06b1a101e6de8>:0 
      at Telerik.XamarinForms.DataControlsRenderer.Android.RadListViewDataSourceAdapter.ClearCachedViews () [0x00000] in <aace7404487f477ba4b06b1a101e6de8>:0 
      at Telerik.XamarinForms.DataControlsRenderer.Android.RadListViewDataSourceAdapter.Dispose (System.Boolean disposing) [0x00003] in <aace7404487f477ba4b06b1a101e6de8>:0 
      at Java.Lang.Object.Dispose () [0x00000] in <ff9f3f3d4e134974a889db1b532c9b6e>:0 
      at Telerik.XamarinForms.DataControlsRenderer.Android.ListViewRenderer.OnElementDetached (Telerik.XamarinForms.DataControls.RadListView oldElement) [0x0003c] in <aace7404487f477ba4b06b1a101e6de8>:0 
      at Telerik.XamarinForms.Common.Android.AndroidRendererBase`2[S,T].Dispose (System.Boolean disposing) [0x0001f] in <061fdf8718854839bc5c73d56b04eafa>:0 
      at Java.Lang.Object.Dispose () [0x00000] in <ff9f3f3d4e134974a889db1b532c9b6e>:0 
      at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Dispose (System.Boolean disposing) [0x000a4] in <9392e6d0fb4f4401a79989cd08844170>:0 
      at Xamarin.Forms.Platform.Android.Platform+DefaultRenderer.Dispose (System.Boolean disposing) [0x0000a] in <9392e6d0fb4f4401a79989cd08844170>:0 
      at Java.Lang.Object.Dispose () [0x00000] in <ff9f3f3d4e134974a889db1b532c9b6e>:0 
      at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Dispose (System.Boolean disposing) [0x000a4] in <9392e6d0fb4f4401a79989cd08844170>:0 
      at Xamarin.Forms.Platform.Android.PageRenderer.Dispose (System.Boolean disposing) [0x00011] in <9392e6d0fb4f4401a79989cd08844170>:0 
      at Java.Lang.Object.Dispose () [0x00000] in <ff9f3f3d4e134974a889db1b532c9b6e>:0 
      at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnDestroyView () [0x0003c] in <9392e6d0fb4f4401a79989cd08844170>:0 
      at Android.Support.V4.App.Fragment.n_OnDestroyView (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <96541ba8a6104b52aadf4218488f978c>:0 
      at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.52(intptr,intptr)

  2. DMITRIY
    DMITRIY avatar
    3 posts
    Member since:
    Feb 2019

    Posted 10 Jul 2019 Link to this post

    Windows 10 Corporate, Microsoft Visual Studio Community 2019 16.1.5, Xamarin.Android SDK 9.3.0.23, Xamarin.Forms 4.1.0.555618, TelerikUIforXamarinTrial v2019.2.708.1
  3. Didi
    Admin
    Didi avatar
    358 posts

    Posted 15 Jul 2019 Link to this post

    Hi Dmitriy,

    Thank you for the provided code.

    I have created a sample based on it and I could not reproduce the issue. 

    Nest Steps:

    Could you please send us a sample where the issue could be reproduced? Note that you should open a support ticket and attach the project there because in the Forum only image attachments are allowed.

    On which Android (device/emulator) versions the issue could be reproduced?

    Thank you in advance and I am looking forward to your reply.

    Regards,
    Didi
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  4. DMITRIY
    DMITRIY avatar
    3 posts
    Member since:
    Feb 2019

    Posted 15 Jul 2019 in reply to Didi Link to this post

    Hi Didi. Thank you for responding.

    Android 9, Samsung SM-J730FM/DS

    and Android 6.0.1, Samsung SM-T585

  5. Didi
    Admin
    Didi avatar
    358 posts

    Posted 16 Jul 2019 Link to this post

    Hi Dmitriy,

    Thank you for the provided details.

    I have reproduced the issue and I have logged a bug report on your behalf in our Feedback portal. You can follow the item on the link below:

    https://feedback.telerik.com/xamarin/1418464-listview-sidedrawer-android-nullreferenceexception-is-thrown-when-navigating-back-and-using-xamarin-forms-4-0-or-higher

    The issue observes when upgrading Xamarin.Forms to 4.0 or higher version. Currently the workaround I could suggest is downgrade to Xamarin.Forms 3.6.

    Let me know if you have any further questions or concerns. 

    Regards,
    Didi
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Alexandre
    Alexandre avatar
    1 posts
    Member since:
    Aug 2019

    Posted 29 Aug 2019 Link to this post

    Hello,

     

    We have de same issue here, with the same stacktrace :

    Xamarin caused by: android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
    Xamarin.Forms.Platform.Android.PageRenderer.Xamarin.Forms.Platform.Android.IOrderedTraversalController.UpdateTraversalOrder()<4ffeb550bcdb42998291a7d8a909a906>:0
    Xamarin.Forms.Platform.Android.VisualElementRenderer<TElement>.UpdateParentPageTraversalOrder()<4ffeb550bcdb42998291a7d8a909a906>:0
    Xamarin.Forms.Platform.Android.VisualElementRenderer<TElement>.OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)<4ffeb550bcdb42998291a7d8a909a906>:0
    at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
    Xamarin.Forms.BindableObject.OnPropertyChanged(string propertyName)<4542de7f0f544d51b46d63bd15d5f6b5>:0
    Xamarin.Forms.Element.OnPropertyChanged(string propertyName)<4542de7f0f544d51b46d63bd15d5f6b5>:0
    Xamarin.Forms.Element.set_Parent(Element value)<4542de7f0f544d51b46d63bd15d5f6b5>:0
    Xamarin.Forms.Element.OnChildRemoved(Element child)<4542de7f0f544d51b46d63bd15d5f6b5>:0
    Xamarin.Forms.ViewCell.set_View(View value)<4542de7f0f544d51b46d63bd15d5f6b5>:0
    Telerik.XamarinForms.DataControlsRenderer.Android.ListView.CellContainerBase.Dispose(bool disposing)<90324dc149d3484fb08216892d6b9051>:0
    Java.Lang.Object.Dispose()<95dc7c80dc234ecda2d399a92cb52cd2>:0
    Telerik.XamarinForms.DataControlsRenderer.Android.FormsListViewDataSourceAdapterBase.ClearCachedViews()<90324dc149d3484fb08216892d6b9051>:0
    Telerik.XamarinForms.DataControlsRenderer.Android.RadListViewDataSourceAdapter.ClearCachedViews()<90324dc149d3484fb08216892d6b9051>:0
    Telerik.XamarinForms.DataControlsRenderer.Android.RadListViewDataSourceAdapter.Dispose(bool disposing)<90324dc149d3484fb08216892d6b9051>:0
    Java.Lang.Object.Dispose()<95dc7c80dc234ecda2d399a92cb52cd2>:0
    Telerik.XamarinForms.DataControlsRenderer.Android.ListViewRenderer.OnElementDetached(RadListView oldElement)<90324dc149d3484fb08216892d6b9051>:0
    Telerik.XamarinForms.Common.Android.AndroidRendererBase<S, T>.Dispose(bool disposing)<ddf44d2dece34c5ba7b29628bd224f32>:0
    Java.Lang.Object.Dispose()<95dc7c80dc234ecda2d399a92cb52cd2>:0
    Xamarin.Forms.Platform.Android.VisualElementRenderer<TElement>.Dispose(bool disposing)<4ffeb550bcdb42998291a7d8a909a906>:0
    Xamarin.Forms.Platform.Android.Platform.DefaultRenderer.Dispose(bool disposing)<4ffeb550bcdb42998291a7d8a909a906>:0
    Java.Lang.Object.Dispose()<95dc7c80dc234ecda2d399a92cb52cd2>:0
    Xamarin.Forms.Platform.Android.VisualElementRenderer<TElement>.Dispose(bool disposing)<4ffeb550bcdb42998291a7d8a909a906>:0
    Xamarin.Forms.Platform.Android.PageRenderer.Dispose(bool disposing)<4ffeb550bcdb42998291a7d8a909a906>:0
    Java.Lang.Object.Dispose()<95dc7c80dc234ecda2d399a92cb52cd2>:0
    Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnDestroyView()<4ffeb550bcdb42998291a7d8a909a906>:0
    Android.Support.V4.App.Fragment.n_OnDestroyView(IntPtr jnienv, IntPtr native__this)<0834cf891e3344b6876acfea6a7c95fc>:0
    at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.47(intptr,intptr)
    md58432a647068b097f9637064b8985a5e0.FragmentContainer.n_onDestroyView(Native Method)
    md58432a647068b097f9637064b8985a5e0.FragmentContainer.onDestroyView()FragmentContainer.java:41
    android.support.v4.app.Fragment.performDestroyView()Fragment.java:2678
    android.support.v4.app.FragmentManagerImpl.moveToState()FragmentManager.java:1533
    android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState()FragmentManager.java:1784
    android.support.v4.app.BackStackRecord.executeOps()BackStackRecord.java:797
    android.support.v4.app.FragmentManagerImpl.executeOps()FragmentManager.java:2625
    android.support.v4.app.FragmentManagerImpl.executeOpsTogether()FragmentManager.java:2411
    android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute()FragmentManager.java:2366
    android.support.v4.app.FragmentManagerImpl.execPendingActions()FragmentManager.java:2273
    android.support.v4.app.FragmentManagerImpl$1.run()FragmentManager.java:733
    android.os.Handler.handleCallback()Handler.java:790
    android.os.Handler.dispatchMessage()Handler.java:99
    android.os.Looper.loop()Looper.java:164
    android.app.ActivityThread.main()ActivityThread.java:7000
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run()RuntimeInit.java:441
    com.android.internal.os.ZygoteInit.main()ZygoteInit.java:1408

     

    The scenario is : 

    Navigation to a view with RadListView. Click on an item, which go to a view with a simple form. When validating this form, a RadCalendar (ViewMode Day) appears in another view, to select a day. When done, a new view appears with another form. Finally, when we validate this form, we go back to home view, which is a Tabbed Page, with a datepicker and a simple listview. On our customer devices, when validate, action is taken, but app crashes.

     

    This issue is not reproductible with our emulators or devices, but it keep appearing on two customer devices :

    - Samsung Galaxy Note 8 (SAMSUNG SM-N950F) (Android 9)

    - Samsung Galaxy Xcover 4 (SAMSUNG SM-G390F) (Android 8.1)

     

    Our Telerik version : 2019.2.802.0

    Our Xamarin Forms version : 4.1.0.709244

     

    We cannot rollback to 3.6 as you suggest, due to other dependencies with breaking changes which were upgraded.

    Have you any plan to fix this issue in a next release ?

     

    Thank you in advance,

     

    Alexandre

     

  7. Didi
    Admin
    Didi avatar
    358 posts

    Posted 30 Aug 2019 Link to this post

    Hello Alexandre,

    I am sorry to hear that the suggested workaround is not suitable for you.

    This issue could be reproduced on Samsung devices. I can assure you that the dev team is currently researching the case. At this time I cannot commit whether a fix for it will be included in the next official release. I can suggest you visit the Feedback Portal item for this issue and click the  "Follow" button to be notified when its status changes.

    Regards,
    Didi
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Ron
    Ron avatar
    25 posts
    Member since:
    Jan 2017

    Posted 08 Oct 2019 Link to this post

    I am also experiencing this issue, and I cannot rollback to a previous version. I require the update that fixes the iOS 13 RadListView layout issue, and that requires Xamarin Forms 4. My Android users are receiving numerous crashes all day long. 

    We need a proper fix for this very quickly. What is the status?

  9. Didi
    Admin
    Didi avatar
    358 posts

    Posted 09 Oct 2019 Link to this post

    Hi Ron,

    We have further researched the case and the reason for the crash is an issue on Xamarin.Forms side. Xamarin team confirmed the erroneous behavior in Xamarin.Forms framework and a fix is planned for the upcoming Xamarin 4.3 release.

    You can find this logged at the following link:

    https://github.com/xamarin/Xamarin.Forms/pull/7050

    https://github.com/xamarin/Xamarin.Forms/issues/7049

    For now, you can try any of the available the 4.3 pre-release versions of Xamarin.Forms ( you would need to check Include prereleases when updating the Xamarin.Forms nuget package).

    I hope the provided information was helpful.

    Regards,
    Didi
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  10. Ron
    Ron avatar
    25 posts
    Member since:
    Jan 2017

    Posted 09 Oct 2019 in reply to Didi Link to this post

    Thank you very much for the reply! I will try using XF 4.3 pre-release and see how that goes. Thank you!
Back to Top