Rg.plugins.popup: UI becomes not responsive after the dialog is closed ( iOS )

Created on 18 Dec 2017  路  13Comments  路  Source: rotorgames/Rg.Plugins.Popup

I am calling it with :

public static void simplePopup( string message )
        {
            onConfirmClicked = null;

            messageText      = message;
            captionText      = "test";

            if( dialogInstance == null )
            {
                try
                {
                    dialogInstance = new SimpleDialog();
                }
                catch( Exception ex )
                {
                }
            }
            try
            {

                ( App.instance.MainPage as ExtendedNavigationPage ).Navigation.PushPopupAsync( dialogInstance );

            }
            catch( Exception ex )
            {
            }
        }

and I am closing it from a "OK" button within the class with the follow code:

private void onButtonConfirmationClicked( object sender, EventArgs e )
        {
            try
            {
                if( onConfirmClicked != null )
                    onConfirmClicked();
            }
            catch( Exception ex )
            {
            }

            try
            {
                //( App.instance.MainPage as ExtendedNavigationPage ).Navigation.PopAllPopupAsync();
                ( App.instance.MainPage as ExtendedNavigationPage ).Navigation.RemovePopupPageAsync( dialogInstance );
            }
            catch( Exception ex )
            {
            }

        }

anyway - once the dialog is closed the page which is on top of the modal stack becomes with not responsive UI.

question

Most helpful comment

@YordanYanakiev Update to 2.4.0.280 or higher.

All 13 comments

@YordanYanakiev Hi. RemovePopupPageAsync and PopAllPopupAsync are async methods. Your should invoke them in the main UI thread and should use an await operator like this:

private async void onButtonConfirmationClicked( object sender, EventArgs e )
        {
            try
            {
                if( onConfirmClicked != null )
                    onConfirmClicked();
            }
            catch( Exception ex )
            {
            }

            try
            {
                //( App.instance.MainPage as ExtendedNavigationPage ).Navigation.PopAllPopupAsync();
                await ( App.instance.MainPage as ExtendedNavigationPage ).Navigation.RemovePopupPageAsync( dialogInstance );
            }
            catch( Exception ex )
            {
            }

        }

if add "await" and turn the click handler into async - the code above throws an Exception ( null ).

@YordanYanakiev Give me a stack trace of the exception

stacktrace

Here the unit if it helps..
unt.zip

@YordanYanakiev Remove try/catch and give me a stack trace from output view after an application crashing.

esource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.fr
2017-12-18 13:24:33.711 SlediForms.iOS[1474:5195913] 
Unhandled Exception:
System.MethodAccessException: Method `Xamarin.Forms.Element:Descendants ()' is inaccessible from method `Rg.Plugins.Popup.IOS.Impl.PopupPlatformIos:DisposeModelAndChildrenRenderers (Xamarin.Forms.VisualElement)'
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_throw_method_access (intptr,intptr)
  at Rg.Plugins.Popup.IOS.Impl.PopupPlatformIos.DisposeModelAndChildrenRenderers (Xamarin.Forms.VisualElement view) [0x00000] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup.IOS\Impl\PopupPlatformIos.cs:74 
  at Rg.Plugins.Popup.IOS.Impl.PopupPlatformIos+<RemoveAsync>d__3.MoveNext () [0x0015e] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup.IOS\Impl\PopupPlatformIos.cs:61 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referenc
amework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at Rg.Plugins.Popup.Services.PopupNavigationImpl+<RemoveAsync>d__10.MoveNext () [0x0003a] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup\Services\PopupNavigationImpl.cs:84 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task 
task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at Rg.Plugins.Popup.Services.PopupNavigationImpl+<RemovePageAsync>d__8.MoveNext () [0x000cf] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup\Services\PopupNavigationImpl.cs:62 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Librar
y/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.Compiler
Services.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at SlediForms.XAMLViews.Dialogs.SimpleDialog+<onButtonConfirmationClicked>d__14.MoveNext () [0x0005b] in D:\XAmarin\Projects\Sledi\Sledi\Sledi\SlediForms\XAMLViews\Dialogs\SimpleDialog.xaml.cs:146 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018 
  at UIK
it.UIKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/UIKit/UIKitSynchronizationContext.cs:24 
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/Foundation/NSAction.cs:163 
  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/5520/51128b8c/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/5520/51128b8c/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at SlediForms.iOS.Application.Main (System.String[] args) [0x00001] in D:\XAmarin\Projects\Sledi\Sledi\Sledi\SlediForms.iOS\Main.cs:17 
2017-12-18 13:
Thread started: <Thread Pool> #37
24:33.718 SlediForms.iOS[1474:5195913] Unhandled managed exception:
Method `Xamarin.Forms.Element:Descendants ()' is inaccessible from method `Rg.Plugins.Popup.IOS.Impl.PopupPlatformIos:DisposeModelAndChildrenRenderers (Xamarin.Forms.VisualElement)' (System.MethodAccessException)
  at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_throw_method_access (intptr,intptr)
  at Rg.Plugins.Popup.IOS.Impl.PopupPlatformIos.DisposeModelAndChildrenRenderers (Xamarin.Forms.VisualElement view) [0x00000] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup.IOS\Impl\PopupPlatformIos.cs:74 
  at Rg.Plugins.Popup.IOS.Impl.PopupPlatformIos+<RemoveAsync>d__3.MoveNext () [0x0015e] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup.IOS\Impl\PopupPlatformIos.cs:61 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesourc
e/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framewor
k/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at Rg.Plugins.Popup.Services.PopupNavigationImpl+<RemoveAsync>d__10.MoveNext () [0x0003a] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup\Services\PopupNavigationImpl.cs:84 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) 
[0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at Rg.Plugins.Popup.Services.PopupNavigationImpl+<RemovePageAsync>d__8.MoveNext () [0x000cf] in C:\projects\rg-plugins-popup\src\Rg.Plugins.Popup\Services\PopupNavigationImpl.cs:62 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Fram
eworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 
  at System.Runtime.CompilerServic
es.TaskAwaiter.GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113 
  at SlediForms.XAMLViews.Dialogs.SimpleDialog+<onButtonConfirmationClicked>d__14.MoveNext () [0x0005b] in D:\XAmarin\Projects\Sledi\Sledi\Sledi\SlediForms\XAMLViews\Dialogs\SimpleDialog.xaml.cs:146 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.3.0.47/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018 
  at UIKit.UIK
itSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/UIKit/UIKitSynchronizationContext.cs:24 
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/5520/51128b8c/source/xamarin-macios/src/Foundation/NSAction.cs:163 
  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/5520/51128b8c/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/5520/51128b8c/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at SlediForms.iOS.Application.Main (System.String[] args) [0x00001] in D:\XAmarin\Projects\Sledi\Sledi\Sledi\SlediForms.iOS\Main.cs:17 
2017-12-18 13:24:33.
719 SlediForms.iOS[1474:5195913] critical: Stacktrace:

2017-12-18 13:24:33.719 SlediForms.iOS[1474:5195913] critical: 
Native stacktrace:

untiasdasdsatled

@YordanYanakiev What version of Xamarin.Forms do you use?

2.3.4.270

and I am using version 1.1.0-pre8 of the plugin ( started to upgrade since the 1.04 had other issue )

@YordanYanakiev Update to 2.4.0.280 or higher.

Confirmed. It was a bug in Xamarin Forms 2.3.4.x as You suggested rotorgames !

Thank You VERY VERY much!

@YordanYanakiev It is not a Xamarin.Forms bug just I forgot to update a min Xamarin.Forms version in nuget. Fixed in v1.1.0-pre9.

Was this page helpful?
0 / 5 - 0 ratings