BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Hi,
That's great! Thanks!
I'm trying your fix but the problem now is bigger.
On iOS when the page opens I remove the gauge from RelativeLayout and add again to fit the screen on OnSizeAllocated.
When I call the Children.Remove passing a control with a SFGauge inside, it give me a NullReferenceException
Can you take a look please, now it's unusable.
Thanks
Your example, works I can't reproduce my problem in your example, but may with this info you could find the problem:
- I'm using a custom control with a SFGauge in a library project
- In my page (in Xamarin Forms project) there is 2 instaces of this control, so 2 SFGauges will appear in the page
- I'm removing the control from the RelativeLayout on OnSizeAllocated, to reposition it when user rotate the screen.
Here is the error stack:
System.NullReferenceException: Object reference not set to an instance of an object
at Syncfusion.SfGauge.iOS.SFCircularGauge.MovedToSuperview () [0x00024] in <7845f32627aa48f38bf0ab603ff23021>:0
at at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSendSuper (intptr,intptr)
at UIKit.UIView.RemoveFromSuperview () [0x0002a] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/src/build/ios/native/UIKit/UIView.g.cs:1402
at Syncfusion.SfGauge.XForms.iOS.SfGaugeRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x0001d] in <1e565a9d2e9241cb9583a4173f856caa>:0
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00118] in <710620a3d4a94be99b29618147548b59>:0
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Dispose (System.Boolean disposing) [0x0007b] in <710620a3d4a94be99b29618147548b59>:0
at Xamarin.Forms.Platform.iOS.ViewRenderer`2[TView,TNativeView].Dispose (System.Boolean disposing) [0x00000] in <710620a3d4a94be99b29618147548b59>:0
at Foundation.NSObject.Dispose () [0x00000] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/src/Foundation/NSObject2.cs:133
at Xamarin.Forms.Platform.iOS.Platform.DisposeModelAndChildrenRenderers (Xamarin.Forms.Element view) [0x00038] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:231
at Xamarin.Forms.Platform.iOS.Platform.HandleChildRemoved (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Platform.cs:342
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00008] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:601
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00022] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:604
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00022] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:604
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00022] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:604
at Xamarin.Forms.Element.OnDescendantRemoved (Xamarin.Forms.Element child) [0x00022] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:604
at Xamarin.Forms.Element.OnChildRemoved (Xamarin.Forms.Element child) [0x00021] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Element.cs:368
at Xamarin.Forms.VisualElement.OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:578
at Xamarin.Forms.Layout`1[T].OnChildRemoved (Xamarin.Forms.Element child) [0x00000] in <0f1ce60dbc6b4e24af01294c7acf41c6>:0
at Xamarin.Forms.Layout.OnInternalRemoved (Xamarin.Forms.View view) [0x00012] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:417
at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0002f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\Layout.cs:381
at 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) [0x0000f] in <3d3bed331af843baa5877f5ed09f45e1>:0
at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00009] in <3d3bed331af843baa5877f5ed09f45e1>:0
at System.Collections.ObjectModel.ObservableCollection`1[T].RemoveItem (System.Int32 index) [0x0002b] in <3d3bed331af843baa5877f5ed09f45e1>:0
at System.Collections.ObjectModel.Collection`1[T].Remove (T item) [0x00027] in <5fd075b6ff6143c68dcfdd192b8757c5>:0
at Xamarin.Forms.ObservableWrapper`2[TTrack,TRestrict].Remove (TRestrict item) [0x00035] in <0f1ce60dbc6b4e24af01294c7acf41c6>:0
at Rabbit2.Pages.NavigationTrip.OnSizeAllocated (System.Double width, System.Double height) [0x00081] in /Users/joaofortes/dev/Rabbit/Rabbit2/Rabbit2/Rabbit2/Pages/NavigationTrip.xaml.cs:60
at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:629
at Xamarin.Forms.VisualElement.SetSize (System.Double width, System.Double height) [0x00021] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:773
at Xamarin.Forms.VisualElement.set_Bounds (Xamarin.Forms.Rectangle value) [0x0005d] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:157
at Xamarin.Forms.VisualElement.Layout (Xamarin.Forms.Rectangle bounds) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\VisualElement.cs:511
at Xamarin.Forms.MasterDetailPage.Xamarin.Forms.IMasterDetailPageController.set_DetailBounds (Xamarin.Forms.Rectangle value) [0x0001a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\MasterDetailPage.cs:105
at Xamarin.Forms.Platform.iOS.TabletMasterDetailRenderer.ViewDidLayoutSubviews () [0x00085] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\TabletMasterDetailRenderer.cs:193
at at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/4991/4a279c9a/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at Rabbit2.iOS.Application.Main (System.String[] args) [0x00001] in /Users/joaofortes/dev/Rabbit/Rabbit2/Rabbit2/Rabbit2.iOS/Main.cs:17
attached is a project where you can see the problem. It's on about page.
solved! Thanks!