Skip to content
This repository was archived by the owner on Jun 11, 2022. It is now read-only.
This repository was archived by the owner on Jun 11, 2022. It is now read-only.

Critical Erro : Foundation.NSObject.xamarin_release_managed_ref #1

@Aktar

Description

@Aktar

Hey, I'm using TZStackView, I noticed that if I go back and forth from a view containing a StackView, at some point your going to have this error :

2016-04-07 16:16:49.808 MyProject[7208:161052] critical:   at <unknown> <0xffffffff>
2016-04-07 16:16:49.808 MyProject[7208:161052] critical:   at (wrapper managed-to-native) Foundation.NSObject.xamarin_release_managed_ref (intptr,intptr) <0x00012>
2016-04-07 16:16:49.808 MyProject[7208:161052] critical:   at Foundation.NSObject.ReleaseManagedRef () [0x00000] in /Users/builder/data/lanes/2922/f51047c6/source/maccore/src/Foundation/NSObject2.cs:200
2016-04-07 16:16:49.809 MyProject[7208:161052] critical:   at Foundation.NSObject/NSObject_Disposer.Drain (Foundation.NSObject) [0x00062] in /Users/builder/data/lanes/2922/f51047c6/source/maccore/src/Foundation/NSObject2.cs:780

You can prevent this by overriding WillMoveToSuperview in StackView.cs

        public override void WillMoveToSuperview(UIView newsuper)
        {
            if(newsuper == null && this.Subviews != null)
            {
                foreach (var view in this.Subviews)
                {
                    view.RemoveFromSuperview();
                }
            }
            base.WillMoveToSuperview(newsuper);
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions