MobileBlazorBindings
MobileBlazorBindings copied to clipboard
ObjectDisposedException is throwing after closing Blazor WebView on Android
Hello! System.ObjectDisposedException is throwing in several seconds after I tap back button and moving to the previous page. Important that it only occurs when I tap back button during Blazor is doing some work. I guess it happens because Blazor tried to render the page, but WebView is already closed. What can I do in order to avoid this issue? Thanks a lot!
This definitely looks like a bug. You're using the "physical" back button (the triangle at the bottom) to go back?
Yes, I am.
After update some nuggets this error seems to be solved for me. I can do a pull request if it could help. https://github.com/Jon2G/MobileBlazorBindings
I'm getting the same error after the app goes to the background, resumes and someone tries to use a button, more specific to navigate to another page using the navigation manager.
Seems like xamarin can't restore the webview's previous state. Any ideas? I was thinking of completely killing the process so it can create a new instance but i still can't put that to test... Not to mention that i understand iOS doesn't allow killing your own process.
@ezesil Maybe we can try now with MAUI support for RazorWebView? I mean I know it's on preview but I can give it a try and see how it works now.
@Jon2G I tried MAUI but for some reason i couldn't get the navigation manager to work unfortunately... Maybe i used an outdated template? Anyways, I managed to find a workaround by simply adding "return;" to an overrided OnSaveInstanceState on the android project --> MainActivity.cs instead of handling the bundle. For some reason it works flawlessly... Could be that returning that event making it not call base.OnSaveInstanceState makes android handle the pause and background states properly? It's counter-intuitive haha.
As a side topic, is MBB capable of loading bootstrap's javascript to visually change the DOM once? I can't seem to find how honestly... MAUI does load them properly!
Edit: typo