NRE coming from SfSegmentedControl Dispose when calling Remove() on StackLayout

Hi!

Hope you are well :)

I am getting a NRE exception with the latest version of the SfSegmentedControl for Xamarin.Forms on iOS.

It was working in version 17.3.0.28

I have attached a small repo project.

Upon tapping Refresh Segmented Control button in the sample an NRE will be generated on iOS.

  at Syncfusion.iOS.Buttons.SfSegmentedControl.Dispose (System.Boolean disposing) [0x0009e] in <9e1ad1d230e54358b87472598e144a7d>:0 
  at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.20.2.2/src/Xamarin.iOS/Foundation/NSObject2.cs:144 
  at Xamarin.Forms.Platform.iOS.ViewRenderer`2[TView,TNativeView].Dispose (System.Boolean disposing) [0x0003d] in D:\a\1\s\Xamarin.Forms.Platform.iOS\ViewRenderer.cs:119 
  at Syncfusion.XForms.iOS.Buttons.SfSegmentedControlRenderer.Dispose (System.Boolean disposing) [0x0001d] in <9e1ad1d230e54358b87472598e144a7d>:0 
  at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.20.2.2/src/Xamarin.iOS/Foundation/NSObject2.cs:144 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildRemoved (Xamarin.Forms.VisualElement view) [0x0003e] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:141 
  at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildRemoved (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x0000f] in D:\a\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:178 
  at Xamarin.Forms.Element.OnChildRemoved (Xamarin.Forms.Element child) [0x00007] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:337 
  at Xamarin.Forms.VisualElement.OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:825 
  at Xamarin.Forms.Layout`1[T].OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:41 
  at Xamarin.Forms.Layout.OnInternalRemoved (Xamarin.Forms.View view) [0x00012] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:473 
  at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0002b] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:436 
  at (wrapper delegate-invoke) <Module>.invoke_void_object_NotifyCollectionChangedEventArgs(object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00018] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:263 
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:338 
  at System.Collections.ObjectModel.ObservableCollection`1[T].RemoveItem (System.Int32 index) [0x00021] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:182 
  at System.Collections.ObjectModel.Collection`1[T].Remove (T item) [0x00027] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs:128 
  at Xamarin.Forms.ObservableWrapper`2[TTrack,TRestrict].Remove (TRestrict item) [0x00035] in D:\a\1\s\Xamarin.Forms.Core\ObservableWrapper.cs:94 
  at SfSegmentedControl_Error.MainPage.Button_OnClicked (System.Object sender, System.EventArgs e) [0x00020] in C:\Dev\Playground\Error Repro\SfSegmentedControl_Error\SfSegmentedControl_Error\SfSegmentedControl_Error\MainPage.xaml.cs:19 
  at Xamarin.Forms.Button.Xamarin.Forms.Internals.IButtonElement.PropagateUpClicked () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Button.cs:187 
  at Xamarin.Forms.ButtonElement.ElementClicked (Xamarin.Forms.VisualElement visualElement, Xamarin.Forms.Internals.IButtonElement ButtonElementManager) [0x0001f] in D:\a\1\s\Xamarin.Forms.Core\ButtonElement.cs:61 
  at Xamarin.Forms.Button.SendClicked () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Button.cs:173 
  at Xamarin.Forms.Platform.iOS.ButtonElementManager.OnButtonTouchUpInside (Xamarin.Forms.IButtonController element) [0x00009] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ButtonElementManager.cs:86 
  at Xamarin.Forms.Platform.iOS.ButtonRenderer.OnButtonTouchUpInside (System.Object sender, System.EventArgs eventArgs) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\ButtonRenderer.cs:190 
  at UIKit.UIControlEventProxy.Activated () [0x00004] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.20.2.2/src/Xamarin.iOS/UIKit/UIControl.cs:38 

Please let me know if you have any questions.

Many thanks!
Ant

Attachment: SfSegmentedControl_Error_de1a29f3.zip

6 Replies 1 reply marked as answer

SS Suganya Sethuraman Syncfusion Team September 9, 2020 08:40 AM UTC

Hi Anthony,

Greetings from Syncfusion.

We have checked the reported issue and we could able to reproduce the issue and we have fixed the issue, please find the assemblies from below.

Custom Assemblies:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/Segment_Assembly-15756989

Assembly version :18.2.0.57

Since 18.2.0.57 is a weekly NuGet release, we are not able to generate patch in 18.2.0.57 version. We can generate patch only for Main release and SP1 release versions, so we have provided the custom assemblies in 18.2.0.57.

Disclaimer:
 
Please note that we have created this for version 18.2.0.56 specifically to resolve the issue reported in this incident. If you have received other patches for the same version for other products, please apply all patches in the order received.

Please refer the below link for how to apply custom assemblies.
 
https://www.syncfusion.com/kb/8279/how-to-apply-the-custom-assemblies-when-configured-the-project-with-syncfusion-nuget

Fix for the reported issue will be included in our upcoming weekly NuGet release. Which will be available on September 15, 2020.

Regards,
Suganya Sethuraman.
 



AR Anthony Ramirez September 10, 2020 12:06 AM UTC

Excellent!

Thanks so much Suganya for your fast resolution to the error.

I will test and be sure to let you know if I run into any issues.

All the best!
Ant


SS Suganya Sethuraman Syncfusion Team September 10, 2020 04:56 AM UTC

Hi Anthony,

Thanks for the update.

We will wait until hear from you.

Regards,
Suganya Sethuraman.
 



AR Anthony Ramirez September 10, 2020 09:34 PM UTC

Hi Suganya!

The error appears to be resolved in the provided DLL. I look forward to upgrading to the weekly build.

Many thanks again for your quick assistance.

All the best!
Ant


SS Suganya Sethuraman Syncfusion Team September 11, 2020 05:43 AM UTC

Hi Anthony,

Thanks for the update.

As we said earlier, the fix for the reported issue will be included in our upcoming weekly NuGet release which will be available on September 15, 2020.
 
Regards,
Suganya S
 



SS Suganya Sethuraman Syncfusion Team September 15, 2020 03:12 PM UTC

Hi Anthony,

Thanks for the patience.

We are glad to announce that our weekly NuGet version 18.2.0.58 was rolled out and the fix for the reported was included in the weekly NuGet.

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

Regards,
Suganya Sethuraman.
 


Marked as answer
Loader.
Up arrow icon