Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Access A Disposed Object #83

Open
raselldev opened this issue Sep 20, 2023 · 5 comments
Open

Cannot Access A Disposed Object #83

raselldev opened this issue Sep 20, 2023 · 5 comments

Comments

@raselldev
Copy link

Thank you for creating Mopups,
Currently i got some error like this:

Terminating app due to uncaught exception 'System.ObjectDisposedException', reason: 'Cannot access a disposed object.
Object name: 'Mopups.Platforms.iOS.PopupWindow'. (System.ObjectDisposedException)
at ObjCRuntime.ThrowHelper.ThrowObjectDisposedException(Object o)
at Foundation.NSObject.get_SuperHandle()
at UIKit.UIView.get_Bounds()
at BigTed.ProgressHUD.PositionHUD(NSNotification notification)
at Foundation.InternalNSNotificationHandler.Post(NSNotification s)

My shell using SimpleShell: https://github.com/RadekVyM

Let me explain our flow,

  1. User hit button on Mopups Page, the button contain code
    try { Application.Current.MainPage = Handler.MauiContext.Services.GetRequiredService<FlyoutShell>(); } catch(Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); }
2. After this, user get MainPage 

`

public FlyoutShell()
{
InitializeComponent();

    MopupService.Instance.PopAsync();
}
`
@raselldev
Copy link
Author

Any updates for this issue? @LuckyDucko

@vatttsall
Copy link

Did you find any workaround?

@vecalion
Copy link

vecalion commented Mar 8, 2024

@raselldev @vatttsall did you figure out what is/was wrong? I'm facing the same issue in my project.

@doriangh
Copy link

doriangh commented May 21, 2024

@LuckyDucko I am experiencing the same issue. In my case, if I have a popup open, and I show a spinner (using Acr.UserDialogs), after closing the popup the app crashes when opening the keyboard with the following stacktrace:

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Mopups.Platforms.iOS.PopupWindow'.
at ObjCRuntime.ThrowHelper.ThrowObjectDisposedException(Object o) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/ThrowHelper.cs:line 52
at Foundation.NSObject.get_SuperHandle() in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:line 615
at UIKit.UIView.get_Bounds() in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/dotnet/ios/generated-sources/UIKit/UIView.g.cs:line 3088
at BigTed.ProgressHUD.PositionHUD(NSNotification notification)
at Foundation.InternalNSNotificationHandler.Post(NSNotification s) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSNotificationCenter.cs:line 49
--- End of stack trace from previous location ---

@wynston-champion-actabl

@doriangh I had the same issue and adding await Task.Delay(500); above the Acr.UserDialogs ShowLoading() fixed the issue for me. I know it's not the best solution, but it is helping in the interim until it's fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants