BottomNavigationBarXF: Keep getting System.InvalidOperationException: Sequence contains no matching element

Can you please document how to use this control? I have looked at the source code which compiles and runs fine, but when I use the nuget package instead, I’m getting a runtime exception.

08-02 01:17:41.571 I/MonoDroid( 8293): UNHANDLED EXCEPTION:
08-02 01:17:41.581 I/MonoDroid( 8293): System.InvalidOperationException: Sequence contains no matching element
08-02 01:17:41.581 I/MonoDroid( 8293):   at System.Linq.Enumerable.Single[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x0008c] in /Users/builder/data/lanes/3511/0831d928/source/mono/mcs/class/referencesource/System.Core/System/Linq/Enumerable.cs:1065 
08-02 01:17:41.581 I/MonoDroid( 8293):   at BottomBar.Droid.ReflectedProxy`1[T].Call (System.String methodName, System.Object[] parameters) [0x00020] in <filename unknown>:0 
08-02 01:17:41.581 I/MonoDroid( 8293):   at BottomBar.Droid.PageController.SendAppearing () [0x00000] in <filename unknown>:0 
08-02 01:17:41.581 I/MonoDroid( 8293):   at BottomBar.Droid.Renderers.BottomBarPageRenderer.OnAttachedToWindow () [0x00006] in <filename unknown>:0 
08-02 01:17:41.581 I/MonoDroid( 8293):   at Android.Views.View.n_OnAttachedToWindow (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in /Users/builder/data/lanes/3511/400a4fc9/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.View.cs:13912 
08-02 01:17:41.581 I/MonoDroid( 8293):   at (wrapper dynamic-method) System.Object:f62e0551-38d7-4f66-afe1-60e4a4af9f0d (intptr,intptr)
08-02 01:17:41.581 I/MonoDroid( 8293): [MVID] 4298aaf593114c7e9ca4ac4b529e50c5 4
08-02 01:17:41.581 I/MonoDroid( 8293): [MVID] a3f8a31db4d344b780468ee114c86386 0
08-02 01:17:41.581 I/MonoDroid( 8293): [MVID] dea6c07ac3b4406aacba3e3f945fe846 1,2,3
08-02 01:17:41.621 W/art     ( 8293): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
08-02 01:17:41.621 D/Mono    ( 8293): DllImport searching in: '__Internal' ('(null)').
08-02 01:17:41.621 D/Mono    ( 8293): Searching for 'java_interop_jnienv_throw'.
08-02 01:17:41.621 D/Mono    ( 8293): Probing 'java_interop_jnienv_throw'.
08-02 01:17:41.621 D/Mono    ( 8293): Found as 'java_interop_jnienv_throw'.
The thread 'Unknown' (0x4) has exited with code 0 (0x0).
An unhandled exception occured.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

To understand the difference, I added the following to both projects, mine and yours, to compare the difference and find why it’s failing to find methodName == SendAppearing:

        foreach (var item in _targetMethodInfoList)
                Console.WriteLine(item.Name);

My project:

get_PageController
get_ElementController
get_BackgroundImage
set_BackgroundImage
get_Icon
set_Icon
get_IsBusy
set_IsBusy
get_Padding
set_Padding
get_Title
set_Title
get_ToolbarItems
set_ToolbarItems
Xamarin.Forms.IPageController.get_ContainerArea
Xamarin.Forms.IPageController.set_ContainerArea
Xamarin.Forms.IPageController.get_IgnoresContainerArea
Xamarin.Forms.IPageController.set_IgnoresContainerArea
Xamarin.Forms.IPageController.get_InternalChildren
get_LogicalChildrenInternal
add_LayoutChanged
remove_LayoutChanged
add_Appearing
remove_Appearing
add_Disappearing
remove_Disappearing
DisplayActionSheet
DisplayAlert
DisplayAlert
ForceLayout
SendBackButtonPressed
LayoutChildren
OnAppearing
OnBackButtonPressed
OnBindingContextChanged
OnChildMeasureInvalidated
OnDisappearing
OnParentSet
OnSizeAllocated
UpdateChildrenLayout
OnChildMeasureInvalidated
Xamarin.Forms.IPageController.SendAppearing
Xamarin.Forms.IPageController.SendDisappearing
InternalChildrenOnCollectionChanged
OnInternalAdded
OnInternalRemoved
OnPageBusyChanged
OnToolbarItemsCollectionChanged
ShouldLayoutChildren
get_AnchorX
set_AnchorX
get_AnchorY
set_AnchorY
get_BackgroundColor
set_BackgroundColor
get_Behaviors
get_Bounds
get_Height
get_HeightRequest
set_HeightRequest
get_InputTransparent
set_InputTransparent
get_IsEnabled
set_IsEnabled
get_IsFocused
get_IsVisible
set_IsVisible
get_MinimumHeightRequest
set_MinimumHeightRequest
get_MinimumWidthRequest
set_MinimumWidthRequest
get_Navigation
set_Navigation
get_Opacity
set_Opacity
get_Rotation
set_Rotation
get_RotationX
set_RotationX
get_RotationY
set_RotationY
get_Scale
set_Scale
get_Style
set_Style
get_StyleClass
set_StyleClass
get_TranslationX
set_TranslationX
get_TranslationY
set_TranslationY
get_Triggers
get_Width
get_WidthRequest
set_WidthRequest
get_X
get_Y
get_Batched
get_ComputedConstraint
set_ComputedConstraint
get_Constraint
get_DisableLayout
set_DisableLayout
get_IsInNativeLayout
set_IsInNativeLayout
get_IsNativeStateConsistent
set_IsNativeStateConsistent
get_IsPlatformEnabled
set_IsPlatformEnabled
get_NavigationProxy
get_SelfConstraint
set_SelfConstraint
BatchBegin
BatchCommit
get_Resources
set_Resources
add_ChildrenReordered
remove_ChildrenReordered
Focus
add_Focused
remove_Focused
GetSizeRequest
Layout
Measure
add_MeasureInvalidated
remove_MeasureInvalidated
add_SizeChanged
remove_SizeChanged
Unfocus
add_Unfocused
remove_Unfocused
InvalidateMeasure
OnChildAdded
OnChildRemoved
OnChildrenReordered
OnMeasure
OnSizeRequest
SizeAllocated
add_BatchCommitted
remove_BatchCommitted
ComputeConstrainsForChildren
ComputeConstraintForView
add_FocusChangeRequested
remove_FocusChangeRequested
InvalidateMeasureInternal
MockBounds
OnConstraintChanged
OnIsPlatformEnabledChanged
OnIsVisibleChanged
OnParentResourcesChanged
UnmockBounds
get_AutomationId
set_AutomationId
get_ClassId
set_ClassId
get_Effects
get_Id
get_ParentView
get_StyleId
set_StyleId
get_Owned
set_Owned
get_ParentOverride
set_ParentOverride
get_Platform
set_Platform
get_RealParent
get_Parent
set_Parent
add_ChildAdded
remove_ChildAdded
add_ChildRemoved
remove_ChildRemoved
add_DescendantAdded
remove_DescendantAdded
add_DescendantRemoved
remove_DescendantRemoved
RemoveDynamicResource
SetDynamicResource
OnPropertyChanged
Descendants
OnParentResourcesChanged
OnRemoveDynamicResource
OnResourcesChanged
OnResourcesChanged
OnSetDynamicResource
add_ParentSet
remove_ParentSet
add_PlatformSet
remove_PlatformSet
SetChildInheritedBindingContext
VisibleDescendants
get_BindingContext
set_BindingContext
add_PropertyChanged
remove_PropertyChanged
add_BindingContextChanged
remove_BindingContextChanged
ClearValue
ClearValue
GetValue
add_PropertyChanging
remove_PropertyChanging
RemoveBinding
SetBinding
SetValue
SetValue
ApplyBindings
OnPropertyChanging
UnapplyBindings
GetIsBound
GetValues
GetValues
RemoveDynamicResource
SetBinding
SetDynamicResource
SetDynamicResource
SetValue
SetValueCore
SetValueCore
SetValueCore
Equals
Finalize
GetHashCode
GetType
MemberwiseClone
ToString

Your Project

get_BackgroundImage
set_BackgroundImage
get_Icon
set_Icon
get_IsBusy
set_IsBusy
get_Padding
set_Padding
get_Title
set_Title
get_ToolbarItems
set_ToolbarItems
get_ContainerArea
set_ContainerArea
get_IgnoresContainerArea
set_IgnoresContainerArea
get_InternalChildren
get_LogicalChildren
add_LayoutChanged
remove_LayoutChanged
add_Appearing
remove_Appearing
add_Disappearing
remove_Disappearing
DisplayActionSheet
DisplayAlert
DisplayAlert
ForceLayout
SendBackButtonPressed
LayoutChildren
OnAppearing
OnBackButtonPressed
OnBindingContextChanged
OnChildMeasureInvalidated
OnDisappearing
OnParentSet
OnSizeAllocated
UpdateChildrenLayout
OnChildMeasureInvalidated
SendAppearing
SendDisappearing
InternalChildrenOnCollectionChanged
OnInternalAdded
OnInternalRemoved
OnPageBusyChanged
OnToolbarItemsCollectionChanged
ShouldLayoutChildren
get_AnchorX
set_AnchorX
get_AnchorY
set_AnchorY
get_BackgroundColor
set_BackgroundColor
get_Behaviors
get_Bounds
get_Height
get_HeightRequest
set_HeightRequest
get_InputTransparent
set_InputTransparent
get_IsEnabled
set_IsEnabled
get_IsFocused
get_IsVisible
set_IsVisible
get_MinimumHeightRequest
set_MinimumHeightRequest
get_MinimumWidthRequest
set_MinimumWidthRequest
get_Navigation
set_Navigation
get_Opacity
set_Opacity
get_Rotation
set_Rotation
get_RotationX
set_RotationX
get_RotationY
set_RotationY
get_Scale
set_Scale
get_Style
set_Style
get_StyleClass
set_StyleClass
get_TranslationX
set_TranslationX
get_TranslationY
set_TranslationY
get_Triggers
get_Width
get_WidthRequest
set_WidthRequest
get_X
get_Y
get_Batched
get_ComputedConstraint
set_ComputedConstraint
get_Constraint
get_DisableLayout
set_DisableLayout
get_IsInNativeLayout
set_IsInNativeLayout
get_IsNativeStateConsistent
set_IsNativeStateConsistent
get_IsPlatformEnabled
set_IsPlatformEnabled
get_NavigationProxy
get_SelfConstraint
set_SelfConstraint
BatchBegin
BatchCommit
get_Resources
set_Resources
add_ChildrenReordered
remove_ChildrenReordered
Focus
add_Focused
remove_Focused
GetSizeRequest
Layout
Measure
add_MeasureInvalidated
remove_MeasureInvalidated
add_SizeChanged
remove_SizeChanged
Unfocus
add_Unfocused
remove_Unfocused
InvalidateMeasure
OnChildAdded
OnChildRemoved
OnChildrenReordered
OnMeasure
OnSizeRequest
SizeAllocated
add_BatchCommitted
remove_BatchCommitted
ComputeConstrainsForChildren
ComputeConstraintForView
add_FocusChangeRequested
remove_FocusChangeRequested
InvalidateMeasure
MockBounds
OnConstraintChanged
OnIsPlatformEnabledChanged
OnIsVisibleChanged
OnParentResourcesChanged
UnmockBounds
get_AutomationId
set_AutomationId
get_ClassId
set_ClassId
get_Effects
get_Id
get_ParentView
get_StyleId
set_StyleId
get_Owned
set_Owned
get_ParentOverride
set_ParentOverride
get_Platform
set_Platform
get_RealParent
get_Parent
set_Parent
add_ChildAdded
remove_ChildAdded
add_ChildRemoved
remove_ChildRemoved
add_DescendantAdded
remove_DescendantAdded
add_DescendantRemoved
remove_DescendantRemoved
RemoveDynamicResource
SetDynamicResource
OnPropertyChanged
Descendants
OnParentResourcesChanged
OnRemoveDynamicResource
OnResourcesChanged
OnResourcesChanged
OnSetDynamicResource
add_ParentSet
remove_ParentSet
add_PlatformSet
remove_PlatformSet
SetChildInheritedBindingContext
VisibleDescendants
get_BindingContext
set_BindingContext
add_PropertyChanged
remove_PropertyChanged
add_BindingContextChanged
remove_BindingContextChanged
ClearValue
ClearValue
GetValue
add_PropertyChanging
remove_PropertyChanging
RemoveBinding
SetBinding
SetValue
SetValue
ApplyBindings
OnPropertyChanging
UnapplyBindings
GetIsBound
GetValues
GetValues
RemoveDynamicResource
SetBinding
SetDynamicResource
SetDynamicResource
SetValue
SetValueCore
SetValueCore
SetValueCore
Equals
Finalize
GetHashCode
GetType
MemberwiseClone
ToString

The difference was here: image and here: image

So I think to fix this, you need to change ANY line to use .Contains() after prefix it with . dot along with == in ReflectedProxy.cs

_cachedMethodInfo[methodName] = _targetMethodInfoList.Single(mi => mi.Name == methodName || mi.Name.Contains("." + methodName));
_cachedPropertyInfo[propertyName] = _targetPropertyInfoList.Single(pi => pi.Name == propertyName || pi.Name.Contains("." + propertyName));

@malokuS sorry for the delay, we’re on it 😃

I’m still getting this using the NuGet Package ThriveGmbH.BottomNavigationBar.XF 1.0.0.