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

KeyboardOverlap: System.ObjectDisposedException has been thrown. #163

Open
dzmitry-antonenka opened this issue Oct 24, 2018 · 7 comments
Open

Comments

@dzmitry-antonenka
Copy link

dzmitry-antonenka commented Oct 24, 2018

The exception message is: Cannot access a disposed object. Object name: 'KeyboardOverlapRenderer'

Call stack:
UIKit.UIApplication.UIApplicationMain() in
UIKit.UIApplication.Main(string[] args, System.IntPtr principal, System.IntPtr delegate) in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:79
UIKit.UIApplication.Main(string[] args, string principalClassName, string delegateClassName) in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:63
iOS.Application.Main(string[] args) in …/Main.cs:17

@ikeremozcan
Copy link

I have the same problem either, especially happens in debug mode a lot

@aparnatiwari30
Copy link

I also have the same problem.
Error Message:
Unhandled Exception:
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'KeyboardOverlapRenderer'.

@omanak
Copy link

omanak commented Dec 11, 2018

Has anyone had any luck with this? I am experiencing the same issue.

@cooliopas
Copy link

Same problem here :(

@icalderond
Copy link

I have same problem: Cannot access a disposed object.
Object name: 'KeyboardOverlapRenderer'.

@stivenbr
Copy link

stivenbr commented Feb 14, 2019

"Solution" ?

Hello, In my case it happens when I close the session with masterdetailpage, to solve it we have to close the menu with IsPresented and leave a waiting time to perform the navigation.

Example with PRISM MVVM and MessagingCenter.

MasterPageViewModel.cs (Method)

private async void Logout() 
{
     MessagingCenter.Send(this, "Logout");
     await Task.Delay(500);
              
     // Navigation Login
     await this.NavigationService.NavigateAsync(new Uri("/LoginPage", UriKind.Absolute));
}

MasterPage.xaml.cs

namespace ProjectXamarin.Views
{
    using ProjectXamarin.ViewModels;
    using Xamarin.Forms;

    public partial class MasterPage : MasterDetailPage
    {
        public MasterPage()
        {
            InitializeComponent();

            // Close Menu
            MessagingCenter.Unsubscribe<MasterPageViewModel>(this, "Logout");
            MessagingCenter.Subscribe<MasterPageViewModel>(this, "Logout", (sender) =>
            {
                this.CloseMenu();
            });
        }

        private void CloseMenu() 
        {
            this.IsPresented = false;
        }
    }
}

Sorry my English (Google translator).

@rmgalante
Copy link

I confirmed that stivenbr's solution worked for me. I'm build an app using the Prism framework. So my changes went into one file, the view model class.

MasterDetailPageViewModel.cs

private async Task ItemTappedAsync(MasterDetailPageMenuItem menuItem)
{
        // If the user is logging out, navigate to the LoginPage and make it the main page.
        if (menuItem.Title == Constants.LogoutPage)
        {
                await NavigationService.GoBackToRootAsync();
                // Prevent unhandled exception, System.ObjectDisposedException, on object, KeyboardOverlapRenderer.
                MasterDetailPage1 page = (App.Current.MainPage as MasterDetailPage1);
                if (page != null)
                {
                        page.IsPresented = false;                        
                }
                // Relinquish control to the UI thread
                await Task.Delay(500);
                // Now navigate to the LoginPage
                await NavigationService.NavigateAsync(Constants.LoginPageUri);
                return;
        }
}

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

8 participants