maui: Verify Blazor Hybrid on Android doesn't log exceptions by default

In https://github.com/dotnet/maui/issues/5750, we’ve had a report about Android apps logging a stack trace like:

[System] Uncaught exception thrown by finalizer
[System] java.lang.IllegalStateException: Warning: Router objects should be explicitly closed when no longer required otherwise you may leak handles.
[System] 	at UM.finalize(chromium-TrichromeWebViewGoogle.apk-stable-410410686:4)
[System] 	at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:291)
[System] 	at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:278)
[System] 	at java.lang.Daemons$Daemon.run(Daemons.java:139)
[System] 	at java.lang.Thread.run(Thread.java:923)
[System] Caused by: java.lang.Exception: AutocloseableRouter allocated at:
[System] 	at UM.<init>(chromium-TrichromeWebViewGoogle.apk-stable-410410686:7)
[System] 	at EP.<init>(chromium-TrichromeWebViewGoogle.apk-stable-410410686:6)
[System] 	at org.chromium.content.browser.framehost.RenderFrameHostImpl.<init>(chromium-TrichromeWebViewGoogle.apk-stable-410410686:10)
[System] 	at org.chromium.content.browser.framehost.RenderFrameHostImpl.create(chromium-TrichromeWebViewGoogle.apk-stable-410410686:1)
[System] 	at J.N.MjidYpBx(Native Method)

We should verify that this doesn’t apply to the default app, but rather is something specific to someone’s browser application code. If BlazorWebView is actually leaking something by default we certainly want to fix that.

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 17 (15 by maintainers)

Most upvoted comments

(discussed offline). The issue is with Android 11 / API 30, it does not repro on 12 / 31.

image

It repros on the maui Blazor test app, after a few clicks.

Can meet to demonstrate and maybe figure out how to repro on your machine.

That “warning” text is I think just part of the exception message, not an actual category. The type of the log message is definitely “error.”

Note: I have no idea what this error means or whether it’s bad, but it definitely shows up in a default MAUI Blazor app.