question

SantMehul-6715 avatar image
0 Votes"
SantMehul-6715 asked WenyanZhang-MSFT commented

SIGABRT: Failed to marshal the Objective-C object 0x11a2bce80 (type: Xamarin_Forms_Platform_iOS_HeaderWrapperView)

Stack trace

Runtime.MissingCtor (System.IntPtr ptr, System.IntPtr klass, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution resolution) /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:1092
Runtime.ConstructNSObject[T] (System.IntPtr ptr, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution)
Runtime.GetNSObject[T] (System.IntPtr ptr)
UIView.get_Superview () /Users/builder/azdo/work/1/s/xamarin-macios/src/build/ios/native/UIKit/UIView.g.cs:4802
VisualElementRenderer`1[TElement].UpdateParentPageAccessibilityElements ()
VisualElementRenderer`1[TElement].OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e)
BoxRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\BoxRenderer.cs:70
(wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
BindableObject.OnPropertyChanged (System.String propertyName) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:266
Element.OnPropertyChanged (System.String propertyName) D:\a\1\s\Xamarin.Forms.Core\Element.cs:362
BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:510
BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:446
BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:160
BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:75
Binding.Apply (System.Object context, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty, System.Boolean fromBindingContextChanged) D:\a\1\s\Xamarin.Forms.Core\Binding.cs:143
BindableObject.ApplyBindings (System.Boolean skipBindingContext, System.Boolean fromBindingContextChanged) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:530
BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:246
Element.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) D:\a\1\s\Xamarin.Forms.Core\Element.cs:479
Element.<OnBindingContextChanged>b
83_0 (Xamarin.Forms.BindableObject child, System.Object bc) D:\a\1\s\Xamarin.Forms.Core\Element.cs:310
BindableObjectExtensions.PropagateBindingContext[T] (Xamarin.Forms.BindableObject self, System.Collections.Generic.IList`1[T] children, System.Action`2[T1,T2] setChildBindingContext)
Element.OnBindingContextChanged () D:\a\1\s\Xamarin.Forms.Core\Element.cs:308
VisualElement.OnBindingContextChanged () D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:827
View.OnBindingContextChanged () D:\a\1\s\Xamarin.Forms.Core\View.cs:158
BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject bindable, System.Object value) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:247
Element.SetChildInheritedBindingContext (Xamarin.Forms.Element child, System.Object context) D:\a\1\s\Xamarin.Forms.Core\Element.cs:479
Element.<OnBindingContextChanged>b
83_0 (Xamarin.Forms.BindableObject child, System.Object bc) D:\a\1\s\Xamarin.Forms.Core\Element.cs:310
BindableObjectExtensions.PropagateBindingContext[T] (Xamarin.Forms.BindableObject self, System.Collections.Generic.IList`1[T] children, System.Action`2[T1,T2] setChildBindingContext)
Element.OnBindingContextChanged () D:\a\1\s\Xamarin.Forms.Core\Element.cs:308
Cell.OnBindingContextChanged () D:\a\1\s\Xamarin.Forms.Core\Cells\Cell.cs:156
BindableObject.BindingContextPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:550
BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:512
BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:446
BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:374
BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:349
BindableObject.set_BindingContext (System.Object value) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:31
TemplatedItemsList`2[TView,TItem].UnhookItem (TItem item)
AsyncMethodBuilderCore+<>c.<ThrowAsync>b
_7_0 (System.Object state) /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
NSAsyncSynchronizationContextDispatcher.Apply () /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178
(wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86
UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65
Application.Main (System.String[] args)

dotnet-xamarinformsdotnet-ios
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

WenyanZhang-MSFT avatar image
0 Votes"
WenyanZhang-MSFT answered WenyanZhang-MSFT commented

Hello,
Welcome to our Microsoft Q&A platform!

Runtime.MissingCtor (System.IntPtr ptr, System.IntPtr klass, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution resolution)

System.IntPtr ptr, System.Type type, ObjCRuntime.Runtime+MissingCtorResolution missingCtorResolution

It means constructor of your class is missing. HeaderWrapperView is used in ListViewRenderer, I think it crashes when you use a Listview with header. You could have a try to create CustomRenderer to avoid crashes. You could also use CollectionView instead of Listview.

 [assembly: ExportRenderer (typeof (Label), typeof (CustomLabelRenderer))]
 namespace MyNamespace
 {
        
     public class CustomLabelRenderer : LabelRenderer
     {
         protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
         {
             //Break possibility to go to VisualElement crashing code...
             if (e.PropertyName == VisualElement.IsVisibleProperty.PropertyName)
             {
                 return;
             }
                    
             base.OnElementPropertyChanged(sender, e);
         }
     }
 }

Best Regards,
Wenyan Zhang


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello Zhang. Thanks for the reply

Could you please guide me on creating the CustomRenderer for this HeaderWrapperView which is used in ListViewRenderer. I'm aware about CollectionView, but it is kind of specific requirement because of which i used ListView

Note - I have not used any header in the ListView.

0 Votes 0 ·

Yes, you could refer to https://github.com/xamarin/Xamarin.Forms/issues/9711 , the workaround is CustomRenderer for Lable, I have edited the answer.
You could also check if the Xamarin.Forms is the latest version.

0 Votes 0 ·