Xamarin.Forms.Plugins
Xamarin.Forms.Plugins copied to clipboard
KeyboardOverlap: System.ObjectDisposedException has been thrown.
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
I have the same problem either, especially happens in debug mode a lot
I also have the same problem. Error Message: Unhandled Exception: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'KeyboardOverlapRenderer'.
Has anyone had any luck with this? I am experiencing the same issue.
Same problem here :(
I have same problem: Cannot access a disposed object. Object name: 'KeyboardOverlapRenderer'.
"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).
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;
}
}