Rg.Plugins.Popup
Rg.Plugins.Popup copied to clipboard
Unhandled exception: InvalidCastException in PopupPageRenderer.OnDetachedFromWindow
🐛 Bug Report
My application is crashing because of an unhandled exception inside of PopupPageRenderer.OnDetachedFromWindow.
We need to add a try/catch around this code and in all the places in PopupPageRenderer where the same cast is performed to avoid app crashes(have seen this exact invalid cast exception before, but at a different method).
Existing code is as follows:
protected override void OnDetachedFromWindow()
{
Device.StartTimer(TimeSpan.FromMilliseconds(0), () =>
{
Popup.Context.HideKeyboard(((Activity) Popup.Context).Window.DecorView);
return false;
});
base.OnDetachedFromWindow();
}
This is from my logs:|
020-07-10 17:27:29.225 | 1117649352 | FATAL | AndroidEnvironment.UnhandledException: Handled: False, Exception: System.InvalidCastException: Specified cast is not valid.
at Rg.Plugins.Popup.Droid.Renderers.PopupPageRenderer+<>c.<OnDetachedFromWindow>b__11_0 () [0x0000a] in <2c84bcd5850d4629957fe969f92dd4e6>:0
at Xamarin.Forms.Forms+AndroidPlatformServices+<>c__DisplayClass23_0.<StartTimer>b__0 () [0x00000] in
Expected behavior
Don't crash the app.
Reproduction steps
Unsure of how to reproduce.
Configuration
Version: 1.1.5.188
Platform:
- [ ] :iphone: iOS
- [ X] :robot: Android
- [ ] :checkered_flag: WPF
- [ ] :earth_americas: UWP
- [ ] :apple: MacOS
- [ ] :tv: tvOS
- [ X] :monkey: Xamarin.Forms
@wtheronjones Does this error appear on the latest version?
I’ve since forked the project locally(very recently) and added a try/catch in the right spot, so I couldn’t tell you.
Sent from my iPhone
On Sep 6, 2020, at 5:59 PM, Tyson Elliot Hooker [email protected] wrote:
@wtheronjones Does this error appear on the latest version?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Can you make a PR?
This still seems to be an issue. EDIT: I made a help issue for the problems I was encountering: #641
Hi o am having the dame on uwp, with a recent downloaded version. There is some fix?
same issue for me