iOS SfShimmer Cannot access a disposed object (ShimmerWaveLayer)

Hi,
I'm getting the follwing error when i use SFShimmer in ListView with ListViewCachingStrategy.RetainElement on iOS:

Unhandled managed exception: Cannot access a disposed object.
Object name: 'ShimmerWaveLayer'. (System.ObjectDisposedException)
  at Foundation.NSObject.get_SuperHandle () [0x0004a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.21/src/Xamarin.iOS/Foundation/NSObject2.cs:456
  at CoreAnimation.CALayer.RemoveAllAnimations () [0x0001e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.21/src/Xamarin.iOS/CALayer.g.cs:580
  at Syncfusion.XForms.iOS.Shimmer.ShimmerWaveLayer.Dispose (System.Boolean disposing) [0x0008e] in <2f16578a2dae463381ef868f6fe2f40f>:0
  at Foundation.NSObject.Finalize () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.10.0.21/src/Xamarin.iOS/Foundation/NSObject2.cs:143


The error occurs, when i open the Listview Page, navigate back and open the Listview Page again.

In my DataTemplate i do something like:

Syncfusion.XForms.Shimmer.SfShimmer shimmer = new Syncfusion.XForms.Shimmer.SfShimmer();
Grid gShimmer = new Grid()
{
    ColumnDefinitions = new ColumnDefinitionCollection()
    {
        new ColumnDefinition(){ Width = GridLength.Star }
    },
    RowDefinitions = new RowDefinitionCollection()
    {
        new RowDefinition(){ Height = GridLength.Star }
    }
};
var boxView = new BoxView
{
    HorizontalOptions = LayoutOptions.FillAndExpand,
    VerticalOptions = LayoutOptions.FillAndExpand
};                     
gShimmer.Children.Add(boxView, 0, 0);
shimmer.CustomView = gShimmer;
AbsoluteLayout al = new AbsoluteLayout();
al.Children.Add(shimmer);
al.Children.Add(img);

img.AfterLoading += (sender, ev) =>
{
    Device.BeginInvokeOnMainThread(() => { shimmer.IsActive = false; });   
};


The error is not happening when i use ListViewCachingStrategy.RecycleElement


Syncfusion Version: 18.1.0.42
Xamarin Forms Version: 4.6.0.726


6 Replies

AS Anandraj Selvam Syncfusion Team May 12, 2020 01:32 PM UTC

Hi Michael Koelbl, 
  
Greetings from the Syncfusion. 
  
We have checked the reported query with the code snippet provided which is working fine at our end. Please have the sample for your reference. 
  
  
Could you please share the following details to check it further and provide a possible solution earlier.  
  
·           Modifying the above-provided sample to replicate the issue  
  
·           If possible, can you please share the issue reproducing sample along with replication procedure. 
  
·           Tested on iPhone 11 iOS 13.1 simulator 
  
Regards, 
Anand Raj S. 



MK Michael Koelbl May 13, 2020 12:01 PM UTC

Thank you for your quick response.

Indeed.
I tried your Demo with my iPhone 6 / iOS Version 12.4.6 where i had the error before, but i cannot replicate it with the demo you sent me.
Seams like there is an issue on our side.
Anyway, because of performance we changed permanent to CollectionView.




AS Anandraj Selvam Syncfusion Team May 14, 2020 01:58 PM UTC

Hi Michael, 
  
Thanks for your patience. 
  
The provided update seems like issue is not depend on the iPhone version, it may differ with the navigation flow. Could you please confirm whether you have a same flow in our provided sample or even it is too complex to share your sample, please update us with the Page navigation flow and its page element. 
  
For example: Initial Page (MainPage) [Contains – ContentPage with Button] ->While tapping it leads to have next page (NavigationListPage) [Contains – Shimmer with ListView] 
  
Like that, I hope the above information surely helpful to replicate the same at our end. If possible, share your issue reproducing sample since reported issue is a dispose exception. Hence without proper replication and way of navigation that is too complex to fix the same. 
  
Regards, 
Anand Raj S. 



MK Michael Koelbl May 15, 2020 06:59 AM UTC

Hi,
Our Project is to complex already to share a small Sample Project.
What we have is following.
Note: We are not using XAML. Our App is fully Code Behind.

Our Mainpage is a ContentPage

On the Mainpage we have a Grid with 3 Rows:
1st: Topbar for Navigation
2nd: AbsoluteLayout -> ContentView -> Content = Grid
3rd: Bottombar also for Navigation and Quick Functions

And a static ViewContainer List

So technically the user stays on the Mainpage while he is navigation throw the pages. Only the childs of the Grid in the 2nd Row are changing

This works as follows:
When the User navigates forward, by Button click:
We create a new ContentView with Content = Grid, add it as children of the Grid from the 2nd row add the created viwe to the static Viewcontainer List and "park" the view right outside the screen.
After that, we move the current view left outside the view and move the newly created view to the phonescreen.
Just like:
TranslationX = -ScreenWidth -> Left
TranslationX = 0 -> Center
TranslationX = ScreenWidth -> Right

In the second View there is the Listview which makes the trouble.
Scroll the Listview, and while Listview is still scrolling, press backbutton

When the User navigates backward:
The current view is moved from the center to the right and the previous view is moved from the left to the center.
After that, we remove the last view from our static viewcontainer list. In this case the contentview with the listview.

And when you the open the same view again, the error occours.



DD Devakumar Dhanapoosanam Syncfusion Team May 18, 2020 12:23 PM UTC

Hi Michael, 
 
Thanks for your update. 
 
We are currently analyzing the reported issue based on the provided details at our end and will update you the details on or before May 19, 2020. 
 
Regards, 
Devakumar D 



AS Anandraj Selvam Syncfusion Team May 19, 2020 01:38 PM UTC

Hi Michael Koelbl,  
   
Thanks for the patience.  
   
We have checked the reported query by modifying the sample in code behind which is also working fine at our end. Please have the sample for your reference.  
   
  
Could you please modify the above-provided sample to replicate the issue  to check it further and provide a possible solution earlier.  
  
Regards, 
Anand Raj S. 


Loader.
Up arrow icon