Rg.Plugins.Popup: iOS 10+ crash in plugin version 1.1.0-pre2

PCL Interface:

public class NavigationInternal : INavigationInternal
{
        public async Task ShowItemsAsync(object context)
        {
                await PopupNavigation.Instance.PushAsync(
                        new PopupItemsPage { BindingContext = context });
        }
}

PCL Usage: await navigationInternal.ShowItemsAsync(this); // (this) -> instance of VM

PCL Popup class:

public partial class PopupItemsPage : Rg.Plugins.Popup.Pages.PopupPage
{
        public PopupItemsPage()
        {
            InitializeComponent();
        }
}

It is crashing on iOS 10+, after multiple open/close of popup. P.S. Opening by code, close by tapping background (and make it for multiple times)

Please see the info: NSObject.get_SuperHandle () /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/Foundation/NSObject2.cs line 423 System.ObjectDisposedException: Cannot access a disposed object. Object name: ‘PopupPageRenderer’.

CANNOT ACCESS A DISPOSED OBJECT. OBJECT NAME: ‘POPUPPAGERENDERER’.

_NSObject.get_SuperHandle () /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/Foundation/NSObject2.cs:423

UIViewController.ViewDidLayoutSubviews () /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/build/ios/native/UIKit/UIViewController.g.cs:1210

PopupPageRenderer.ViewDidLayoutSubviews ()

Trampolines+SDAction.Invoke (System.IntPtr block) /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/build/ios/native/ObjCRuntime/Trampolines.g.cs:10343

(wrapper native-to-managed) ObjCRuntime.Trampolines+SDAction:Invoke (intptr)

(wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSend_Double_IntPtr_IntPtr (intptr,intptr,double,intptr,intptr)

UIView.AnimateNotify (System.Double duration, System.Action animation, UIKit.UICompletionHandler completion) /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/build/ios/native/UIKit/UIView.g.cs:370

UIView.AnimateNotifyAsync (System.Double duration, System.Action animation) /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/build/ios/native/UIKit/UIView.g.cs:382

UIView.AnimateAsync (System.Double duration, System.Action animation) /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/UIKit/UIView.cs:177

PopupPageRenderer+<KeyBoardDownNotification>d__19.MoveNext ()

ExceptionDispatchInfo.Throw () /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151

AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018

UIKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/UIKit/UIKitSynchronizationContext.cs:24

NSAsyncActionDispatcher.Apply () /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/Foundation/NSAction.cs:163

(wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)

UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/UIKit/UIApplication.cs:79

UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/UIKit/UIApplication.cs:63

Application.Main (System.String[] args) /Users/alezhuk/Project_X/PinPayment/PinPayment/PinPayment.iOS/Main.cs:14_

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 25 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@rotorgames Using latest, 1.1.4.158-pre. Here is the stack trace I see in AppCenter but I am unable to repro this for now. But I do see users encountering it.

Xamarin Exception Stack: System.NullReferenceException: Object reference not set to an instance of an object at Rg.Plugins.Popup.IOS.Renderers.PopupPageRenderer.ViewDidLayoutSubviews () <0x101db4e54 + 0x0005c> in <c2bf6f1e86b84161baab0dfc470e68f9#510e478a0d8b9e3668d2cdf02e572773>:0 at (wrapper managed-to-native) ObjCRuntime.Messaging.objc_msgSend(intptr,intptr) at CoreAnimation.CATransaction.Commit () <0x1010f6498 + 0x00023> in <0b60c1467e7449608ac42f9c7bbfdd05#510e478a0d8b9e3668d2cdf02e572773>:0 at Xamarin.Forms.Platform.iOS.CADisplayLinkTicker.StartThread () <0x101478e04 + 0x0002f> in <3d97176e5e4b463eb17f36e790a716e1#510e478a0d8b9e3668d2cdf02e572773>:0 at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) <0x10086cbd8 + 0x000e3> in <b238a3153e534349ad10ed0787f2157a#510e478a0d8b9e3668d2cdf02e572773>:0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) <0x10086b268 + 0x00227> in <b238a3153e534349ad10ed0787f2157a#510e478a0d8b9e3668d2cdf02e572773>:0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) <0x10086b1f4 + 0x0002f> in <b238a3153e534349ad10ed0787f2157a#510e478a0d8b9e3668d2cdf02e572773>:0 at System.Threading.ThreadHelper.ThreadStart () <0x10086cd88 + 0x0002f> in <b238a3153e534349ad10ed0787f2157a#510e478a0d8b9e3668d2cdf02e572773>:0

@rotorgames Do you think this bug will get fixed anytime soon? I’m only asking because I’d like to help fix it ASAP. This bug with the latest version 1.1.0 pre2 has completely stopped development for my dev team. let me know, thank you

We encountered the same issue in our Xamarin.Forms application. The app was crashing after tapping the standard Entry Xamarin field on iPhone 11 and iPod 7. Surprisingly the app was working fine on iPhone 12.

Stack trace: ` at Foundation.NSObject.get_SuperHandle () [0x00023] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:471 at UIKit.UIViewController.ViewDidLayoutSubviews () [0x00023] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/UIKit/UIViewController.g.cs:1260 at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLayoutSubviews () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:176 at Rg.Plugins.Popup.IOS.Renderers.PopupPageRenderer.ViewDidLayoutSubviews () [0x00000] in Z:\Documents\OpenSource\Rg.Plugins.Popup\Rg.Plugins.Popup\Platforms\Ios\Renderers\PopupPageRenderer.cs:112 at Rg.Plugins.Popup.IOS.Renderers.PopupPageRenderer.KeyBoardUpNotification (Foundation.NSNotification notifi) [0x0000c] in Z:\Documents\OpenSource\Rg.Plugins.Popup\Rg.Plugins.Popup\Platforms\Ios\Renderers\PopupPageRenderer.cs:136 at Foundation.InternalNSNotificationHandler.Post (Foundation.NSNotification s) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSNotificationCenter.cs:48 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/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65 at Mobile.iOS.Application.Main (System.String[] args) [0x00001] in

The fix was trivial: In the App.xaml.cs constructor we changed setting MainPage from a PopupPage (referencing Rg.Plugins.Popup) to ContentPage. After this, the problem was gone.

Hope that someone will find this useful!