Forum Xamarin.Forms

[Android] App Crashing while Page Navigation with error as NavigationPageRenderer.UpdateToolbar ()

AnbuMani27AnbuMani27 USMember ✭✭✭
edited July 24 in Xamarin.Forms

When I am trying to move from one page to another page, the app is getting crashed with the below error. This is happening after I upgraded the Xamarin.Forms version to 4.7.0.1080

NavigationPageRenderer.UpdateToolbar () - System.NullReferenceException: Object reference not set to an instance of an object.

Xamarin Forms Version: 4.7.0.1080

Note:

  • Sometime App not crashing but BackButton Icon & Header Label not showing.
  • Is there any possibility to resolve this issue by downgrading the Xamarin.Forms version to 4.6 or 4.5.

AppCenter Stack Trace:

Android: 9
Android Build: PKQ1.180917.001
Manufacturer: Xiaomi
Model: Redmi 6 Pro

Xamarin Exception Stack:
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.UpdateToolbar () [0x0007d] in <5cfeb6476b5641c5b43daf7d3f36a1c8>:0
at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer+<>c__DisplayClass97_0.b__0 () [0x0002b] in <5cfeb6476b5641c5b43daf7d3f36a1c8>:0
at Xamarin.Forms.Forms+AndroidPlatformServices+<>c__DisplayClass24_0.b__0 () [0x00000] in <5cfeb6476b5641c5b43daf7d3f36a1c8>:0
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in :0
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in :0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.28(intptr,intptr)

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    Xamarin Exception Stack:
    System.NullReferenceException: Object reference not set to an instance of an object
    at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.UpdateToolbar () [0x0007d] in <5cfeb6476b5641c5b43daf7d3f36a1c8>:0
    at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer+<>c__DisplayClass97_0.b__0 () [0x0002b] in <5cfeb6476b5641c5b43daf7d3f36a1c8>:0
    at Xamarin.Forms.Forms+AndroidPlatformServices+<>c__DisplayClass24_0.b__0 () [0x00000] in <5cfeb6476b5641c5b43daf7d3f36a1c8>:0
    at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in :0
    at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in :0
    at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.28(intptr,intptr)

    From above log, some variable's value in your code should be null. You should initialize it before you use it.

    For this question, you can debug step by step to find the cause of it .

    Besides, you said this error is happening after you upgraded the Xamarin.Forms version to 4.7.0.1080, then you can try to downgrade xamarin forms to previous version, and try again.

    If the problem persists, could you please post a basic demo so that we can test on our side?

  • AnbuMani27AnbuMani27 USMember ✭✭✭

    Hi @jezh ,

    I am tired 4.6.0.726 & 4.6.0.800 Version.

    XF Bug: https://github.com/xamarin/Xamarin.Forms/issues/9509

  • AnbuMani27AnbuMani27 USMember ✭✭✭
  • jezhjezh Member, Xamarin Team Xamurai

    From your demo video, I couldn't find any crash as you mentioned above.

    What's the version of the xamarin from nuget of your demo?
    And have you tested on other devices except Redmi 6 Pro?

  • AnbuMani27AnbuMani27 USMember ✭✭✭

    Hi @jezh,
    Sometimes it is crashing.
    In this video toolbar Label & Back Button Icon not showed.

  • jezhjezh Member, Xamarin Team Xamurai

    Since we couldn't reproduce this question , could you please post a basic demo so that we can test on our side?

  • AnbuMani27AnbuMani27 USMember ✭✭✭

    Hi @jezh ,I found the issue & fixed... Thanks for your response :smile:

  • jezhjezh Member, Xamarin Team Xamurai

    Congrats, and could you please share your answer and mark it so that others will get help from here? Thank you in advance.

Sign In or Register to comment.