We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cannot access a disposed object. Object name: 'BadgeRenderer'.

When you place badge inside list view, like so




where template is like this, where color bind to a property





then if you make a record visible, then scroll to it will be hidden. and programmatically (i.e. from pull to refresh) refresh the view (i.e.
this.model.Orders[this.model.Orders.Count - 1].OrderStatusColor = Colors.Black;

this.ordersListView.RefreshListViewItem(-1, this.model.Orders.Count - 1, true);
)
you get above exception
at Foundation.NSObject.get_SuperHandle () [0x00012] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/Foundation/NSObject2.cs:449
at UIKit.UIView.get_Layer () [0x00025] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.4.0.2/src/Xamarin.iOS/UIView.g.cs:4105
at Syncfusion.XForms.iOS.BadgeView.BadgeRenderer.ResetLayer () [0x00000] in <87ce8985515944cbb57a02ad17819328>:0
at Syncfusion.XForms.iOS.BadgeView.BadgeRenderer.InvalidateRenderer () [0x00000] in <87ce8985515944cbb57a02ad17819328>:0
at Syncfusion.XForms.iOS.BadgeView.BadgeSetting.set_BackgroundColor (UIKit.UIColor value) [0x0001f] in <87ce8985515944cbb57a02ad17819328>:0
at Syncfusion.XForms.iOS.BadgeView.BadgeViewUtility.OnBadgeSettingsPropertyChanged (Syncfusion.XForms.iOS.BadgeView.BadgeSetting nativeSettings, Syncfusion.XForms.BadgeView.BadgeSetting formsSettings, System.String propertyName) [0x001df] in <87ce8985515944cbb57a02ad17819328>:0
at Syncfusion.XForms.iOS.BadgeView.BadgeSetting.FormsSettings_PropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x0000d] in <87ce8985515944cbb57a02ad17819328>:0
BTW, I can't help notice that your BadgeSettings class have an empty IDisposable implementation. Considering it contains other disposable objects it should be changed to dispose/clear references as well
public void Dispose()
{
Dispose(disposing: true);
}

protected virtual void Dispose(bool disposing)
{
}


1 Reply

VR Vignesh Ramesh Syncfusion Team December 20, 2019 03:26 PM UTC

Hi Ilya, 

Greetings from Syncfusion. 

We have prepared the simple sample by placing the SfBadgeView inside the ListView and checked the reported crash. But we afraid that, we are not able to reproduce the reported issue in our side. However, we have fixed the issue using the provided stack trace. Please find the patch for the issue and can be downloaded from the below link.    
   
Please find the patch setup from the below location.    

or    
   
Please find the patch assemblies from the below location.    
   
or   
   
Please find the NuGet from the below location.    
   
Please let us know if you have any other queries.   
   
Assembly Version: 17.4.0.39     
     
Disclaimer:    
Please note that we have created this patch for version 17.4.0.39 specifically to resolve the issue reported in the forum 150095. If you have received other patches for the same version for other products, please apply all patches in the order received.    
   
Also, clear the previous NuGet caches as mentioned in this link and confirm us whether the reported problem is resolved at your end. 

Regards, 
Vignesh.

Loader.
Live Chat Icon For mobile
Up arrow icon