DisposeAsync() on IJSObjectReference causes hanging when called on Android 11 and lower on app suspension #13529
Labels
area-blazor
Blazor Hybrid / Desktop, BlazorWebView
fixed-in-8.0.60
fixed-in-9.0.0-preview.5.24307.10
partner/android
Issues for the Android SDK
platform/android 🤖
s/triaged
Issue has been reviewed
s/verified
Verified / Reproducible Issue ready for Engineering Triage
t/bug
Something isn't working
Milestone
Description
On Android 11 and lower, the back button on the home page has different behaviour from the home button - it finishes the current activity. This was changed on Android 12 (see this page), however on earlier versions, this results in a different behaviour.
This, however, means that pressing back, then re-opening the app causes Blazor to dispose of resources during app initialization when the app has re-opened. This means the WebView has already been disposed of, or not yet initialized - I'm not quite sure which one. This causes any
DisposeAsync()
calls againstIJSObjectReference
objects to hang synchronously.Steps to Reproduce
wwwroot
Transient
orScoped
LoadModuleAsync()
LoadModuleAsync()
is called. Note: Any other JS invoke function could work so long as we're left with anIJSObjectReference
Link to public reproduction project repository
https://github.com/kanadaj/MauiHangRepro
Version with bug
7.0 (current)
Last version that worked well
7.0 (current)
Affected platforms
Android
Affected platform versions
Android 11 and down
Did you find any workaround?
The only workaround we've found is tying
IJSObjectReference
lifecycle to their holding component if they aren't on the home page. No idea about the home page. This also breaks most existing Blazor libraries on Android 11 and under.Relevant log output
No response
The text was updated successfully, but these errors were encountered: