Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] App crash when click menu icon in MasterDetailPageΒ #14546

@jh-mobitech

Description

@jh-mobitech

Description

It happens randomly and I got 3 crashes in last month. It happens when I click menu icon in MasterDetailPage.

After looking into the Source code, the crash happened at:

https://github.com/xamarin/Xamarin.Forms/blob/main/Xamarin.Forms.Core/NavigationPage.cs#L149

public static bool GetHasBackButton(Page page)
{
  if (page == null)
  throw new ArgumentNullException("page");
  return (bool)page.GetValue(HasBackButtonProperty);
}

Here is the StackTrace:

SIGABRT: Value cannot be null. Parameter name: page

Stack traces

NavigationPage.GetHasBackButton (Xamarin.Forms.Page page) D:\a\1\s\Xamarin.Forms.Core\NavigationPage.cs:149
NavigationRenderer+ParentingViewController.UpdateLeftBarButtonItem (Xamarin.Forms.Page pageBeingRemoved) D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:1246
<.ctor>b__14_0 (Xamarin.Forms.Platform.iOS.IVisualElementRenderer sender) D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:44
(wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395
RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:409
MethodBase.Invoke (System.Object obj, System.Object[] parameters) /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Reflection/MethodBase.cs:53
MessagingCenter+Subscription.InvokeCallback (System.Object sender, System.Object args) D:\a\1\s\Xamarin.Forms.Core\MessagingCenter.cs:94
MessagingCenter.InnerSend (System.String message, System.Type senderType, System.Type argType, System.Object sender, System.Object args) D:\a\1\s\Xamarin.Forms.Core\MessagingCenter.cs:217
IMessagingCenter.Send[TSender] (TSender sender, System.String message)
MessagingCenter.Send[TSender] (TSender sender, System.String message)
TabletFlyoutPageRenderer.HandlePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\TabletFlyoutPageRenderer.cs:471
(wrapper delegate-invoke) .invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
BindableObject.OnPropertyChanged (System.String propertyName) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:266
Element.OnPropertyChanged (System.String propertyName) D:\a\1\s\Xamarin.Forms.Core\Element.cs:362
MasterDetailPage.OnPropertyChanged (System.String propertyName) D:\a\1\s\Xamarin.Forms.Core\FlyoutPage.cs:292
BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:510
BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:446
BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:374
BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:349
FlyoutPage.set_IsPresented (System.Boolean value) D:\a\1\s\Xamarin.Forms.Core\FlyoutPage.cs:62
NavigationRenderer+<>c__DisplayClass79_0.g__OnItemTapped|1 (System.Object sender, System.EventArgs e) D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:868
UIBarButtonItem+Callback.Call (Foundation.NSObject sender) /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIBarButtonItem.cs:30
(wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86
UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65
Application.Main (System.String[] args)

Any solution?

Steps to Reproduce

Expected Behavior

Actual Behavior

App crashed.

Basic Information

  • Version with issue: Xamarin.forms 5.0.02012
  • Last known good version:
  • Platform Target Frameworks:
    • iOS:
    • Android:
    • UWP:
  • Android Support Library / AndroidX Version:
  • NuGet Packages:
  • Affected Devices:

Environment

Show/Hide Visual Studio info

Build Logs

Screenshots

Reproduction Link

Workaround

Metadata

Metadata

Assignees

No one assigned

    Labels

    a/masterdetailpages/needs-info ❓A question has been asked that requires an answer before work can continue on this issue.s/needs-repro ❔This reported issue doesn't include a sample project reproducing the issue. Please provide one.s/unverifiedNew report that has yet to be verifiedt/bug πŸ›

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions