-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullReferenceException in UpdateLeftBarButtonItem #14801
Comments
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process. |
Hello, |
Can confirm this issue in our Shell app. Also found it via Crashlytics report. Similar stacktrace.
@jsuarezruiz : Are there any efforts to solve this problem in the near future? Thx Stefan |
@PureWeen Any solution for this? |
@Stefan171086 no workarounds, still happening, can't understand when and why. We found the issue looking into logs, but it never happened in debug or during tests. |
I found the root cause of this exception in our shell app. We had a scenario where we navigate from page A to page B and because of some conditions in page B it triggered a navigation immediately back to page A. And after this immediate back navigation this exception was thrown. Now we solved our problem. May this information helps the MAUI team to fix the BUG in there code. |
I'm facing the same issue. I've tracked it down to fast navigation. For example, when the application starts, if you navigate to the LoginPage or the AboutPage from App.xaml.cs, depending on the authentication status, the error occurs. My current workaround is to have a default AuthenticationPage defined in the AppShell as ShellContentView. In the AuthenticationPage, I wait for a second before performing the navigation. If it helps, I can try to build a repository that reproduces the error. |
I'm facing this one too in MAUI v8.0.40 SR5 ADB log
maui/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cs Line 71 in ecfa829
I can see that UpdateLeftBarButtonItem is declared maui/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cs Line 370 in ecfa829
|
Maybe also something interesting I discovered recently: |
@meierhoeferjannis I'm available to fix this, but I couldn't reproduce from within the MAUI solution. Can you build a sample repo? |
@albyrock87 Hey, |
@meierhoeferjannis I managed to repro and create a PR with the fix, so don't worry (well, unless you discover an additional use case not covered by my fix). |
Description
Fatal Exception: android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
at Microsoft.Maui.Controls.Platform.Compatibility.ShellToolbarTracker.get_MauiContext()
at Microsoft.Maui.Controls.Platform.Compatibility.ShellToolbarTracker.UpdateLeftBarButtonItem(Context context, Toolbar toolbar, DrawerLayout drawerLayout, Page page)
at System.Threading.Tasks.Task.<>c.b__128_0(Object )
at Android.App.SyncContext.<>c__DisplayClass2_0.b__0()
at Java.Lang.Thread.RunnableImplementor.Run()
at Java.Lang.IRunnableInvoker.n_Run(IntPtr , IntPtr )
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V , IntPtr , IntPtr )
at mono.java.lang.RunnableImplementor.n_run(RunnableImplementor.java)
at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:31)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:6769)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Steps to Reproduce
Bug reported by Firebase Crashlytics in Android
com.alphas.growingfamily_issue_50301eaa3143b6359a31e950bc7a3b35_crash_session_6449CF32029A00014999FAE3E68583FE_DNE_0_v2_stacktrace.txt
Link to public reproduction project repository
none
Version with bug
7.0 (current)
Last version that worked well
7.0 (current)
Affected platforms
Android
Affected platform versions
Android 9
Did you find any workaround?
No response
Relevant log output
The text was updated successfully, but these errors were encountered: