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

Null reference exception in Badge renderer

Again, happening when badge is in listview, and been scrolled down and back up and source replaced/ updated. Cannot provide exact way to repro but it's similar problem with disposed object
SfBadgeView.CalculateBadgeSize ()

does not take in account it can be already disposed and renderer is null, but the main problem is in list view calling to render disposed records

  • SfBadgeView.CalculateBadgeSize ()
  • IBadgeDependencyService.SetBadgeSize (System.Object nativeView, Syncfusion.XForms.BadgeView.SfBadgeView badgeView)
  • SfBadgeView.OnMeasure (System.Double widthConstraint, System.Double heightConstraint)
  • VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint)

  • MeasureSize.CalculateSize (Syncfusion.ListView.XForms.SfListView listview, Xamarin.Forms.View content, Xamarin.Forms.Size viewSize, System.Boolean isMeasureInvalidated)
  • LayoutBase.GetAutoFitItemSize (Syncfusion.ListView.XForms.ListViewItemInfoBase itemInfo, System.Double& itemSize, System.Double itemSpacing, System.Int32 spanCount)
  • LinearLayout.GetAutoFitItemSize (Syncfusion.ListView.XForms.ListViewItemInfoBase itemInfo, System.Double& itemSize, System.Double itemSpacing)
  • LinearLayout.SetRowHeight (Syncfusion.ListView.XForms.ListViewItemInfo itemInfo, System.Int32 index, System.Double& size, System.Double itemSpacing)
  • LinearLayout.SetRowHeight (Syncfusion.ListView.XForms.ListViewItemInfo itemInfo, System.Double itemSpacing)
  • LinearLayout.EnsureItems (Syncfusion.GridCommon.ScrollAxis.VisibleLinesCollection visibleLines)
  • VisualContainer.EnsureItems ()
  • VisualContainer.OnSizeAllocated (System.Double width, System.Double height)
  • VisualElement.SizeAllocated (System.Double width, System.Double height)

  • SfListViewHelper.InvalidateForceLayout (Xamarin.Forms.Layout`1[T] view)
  • SfListView.RefreshView (System.Boolean canResetRowHeight)
  • SfListView.RefreshView ()

  • 2 Replies

    RS Ramya Soundar Rajan Syncfusion Team December 31, 2019 02:18 PM UTC

    Hi Ilya,  
    Greeting 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 custom assembly for the issue and can be downloaded from the below link.    
    Please confirm us whether these assemblies resolved the reported crash at your end. 
    Ramya S 

    RS Ramya Soundar Rajan Syncfusion Team December 31, 2019 02:27 PM UTC

    Hi Ilya, 
    In our last update, we have missed to add disclaimer details. Please find the details below. 
    Assembly Version: 
    Please note that we have created this assembly for version specifically to resolve the issue reported in the forum 150240. If you have received other patches for the same version for other products, please apply all assembly in the order received.  
    Ramya S 

    Live Chat Icon For mobile
    Up arrow icon