maui
maui copied to clipboard
java.lang.NullPointerException crashes for android.view.ViewGroup.dispatchGetDisplayList in Release
Android framework version
net8.0-android
Affected platform version
.NET 8 SDK 8.0.401, Maui 8.0.72/8.0.100
Description
In a production application I oversee that runs on .NET MAUI, there are a number of crash issues for Android that are all the exact same stack trace (see below) on AppCenter. The crash rate is approximately 25 users (with about 3-4 crashes per user) out of 25,000 users for a user crash rate of 0.1% [higher if I count the total number of crashes]. While not necessarily egregious, Google Play has a "bad behavior threshold" of 1.09% - so a significant percentage of our max crash rate (9%) is eaten up by this one crash issue. This issue does not affect iOS.
java.lang.NullPointerException: Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference in method 'void android.view.ViewGroup.dispatchGetDisplayList()'
Stack trace
android.view.View.updateDisplayListIfDirty View.java:22798
android.view.ThreadedRenderer.updateViewTreeDisplayList ThreadedRenderer.java:694
android.view.ThreadedRenderer.updateRootDisplayList ThreadedRenderer.java:700
android.view.ThreadedRenderer.draw ThreadedRenderer.java:798
android.view.ViewRootImpl.draw ViewRootImpl.java:5242
android.view.ViewRootImpl.performDraw ViewRootImpl.java:4944
android.view.ViewRootImpl.performTraversals ViewRootImpl.java:4109
android.view.ViewRootImpl.doTraversal ViewRootImpl.java:2687
android.view.ViewRootImpl$TraversalRunnable.run ViewRootImpl.java:9776
android.view.Choreographer$CallbackRecord.run Choreographer.java:1343
android.view.Choreographer$CallbackRecord.run Choreographer.java:1352
android.view.Choreographer.doCallbacks Choreographer.java:952
android.view.Choreographer.doFrame Choreographer.java:882
android.view.Choreographer$FrameDisplayEventReceiver.run Choreographer.java:1326
android.os.Handler.handleCallback Handler.java:1000
android.os.Handler.dispatchMessage Handler.java:104
android.os.Looper.loopOnce Looper.java:242
android.os.Looper.loop Looper.java:362
android.app.ActivityThread.main ActivityThread.java:8393
java.lang.reflect.Method.invoke Method.java
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:552
com.android.internal.os.ZygoteInit.main ZygoteInit.java:992
I have never been able to reproduce this issue in a test project, so I cannot attach one. It is happening rarely - though still with a noticeable impact to app users. Is there anything we can do to fix this issue or investigate it further? From sleuthing online, it appears that other Android applications have seen issues like this when incorrectly disposing of data from one thread while the other is trying to render it (some sort of race condition?). One example is https://stackoverflow.com/questions/33242776/android-viewgroup-crash-attempt-to-read-from-field-int-android-view-view-mview
More Information
The Microsoft.Maui.Controls NuGet package version is 8.0.82. We are pinned to using AndroidX.Core version 1.12.0.3 along with several other support library versions that also use that version of Core (in order to make all of them place nicely with each other, we use that version of the Core library to set the versions of the other Android support libraries in cases where various 3rd party SDKs want various versions of the support libraries). If it helps, I'll drop the full list below (just ask).
Steps to Reproduce
I cannot help with reproduction unfortunately; I have attempted to reproduce this issue several times without success. I will share that our production application makes use of several:
- CollectionViews
- VerticalStackLayouts with BindableLayout (there is really no replacement for this type of layout using just CollectionView)
- Grids
Since the issue points to the update of a "list", it stands to reason that perhaps one of these Android view elements is what is being updated incorrectly when the .NET MAUI version is updated.
Did you find any workaround?
No workaround; this issue appears to effect 0.1% of all Android app users and has been since we started using .NET MAUI.
Relevant log output
See attached