Skip to content
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

Binding PickerCell on SelectedItem crash on Android and iOS #137

Open
2 tasks done
mattiasskog opened this issue Oct 25, 2020 · 1 comment
Open
2 tasks done

Binding PickerCell on SelectedItem crash on Android and iOS #137

mattiasskog opened this issue Oct 25, 2020 · 1 comment

Comments

@mattiasskog
Copy link

Description

When binding to SelectedItem I get Object refrerence not set to an instance of an object.
If I remove the binding the view is opened.

Steps to Reproduce

  1. Add a PickerCell
    <renderers:PickerCell
    Title="TitelOfPicker"
    ItemsSource="{Binding PickerItems}"
    DisplayMember="Name"
    SelectionMode="Single"
    SelectedItem="{Binding PrimaryPickerItem}"
    SelectedCommand="{Binding PickerSelectedCommand}"
    KeepSelectedUntilBack="true"
    PageTitle="Choose your item!" />

  2. Binding is on
    public ReadOnlyObservableCollection PickerItems { get; }

  3. PrimaryPickerItem
    public ItemDataV1 PrimaryPickerItem
    {
    get { return _primaryPickerItem; }
    set { SetProperty(ref _primaryPickerItem, value); }
    }

Expected Behavior

View would open

Actual Behavior

Object reference not set to an instance of an object.

10-25 20:16:28.588 I/MonoDroid(11399): UNHANDLED EXCEPTION:
10-25 20:16:28.592 I/MonoDroid(11399): System.NullReferenceException: Object reference not set to an instance of an object.
10-25 20:16:28.592 I/MonoDroid(11399): at AiForms.Renderers.PickerCell.GetSelectedItemsText () [0x0015a] in <372a7272679343959209201f0047d05b>:0
10-25 20:16:28.592 I/MonoDroid(11399): at AiForms.Renderers.Droid.PickerCellView.UpdateSelectedItems (System.Boolean force) [0x00079] in :0
10-25 20:16:28.592 I/MonoDroid(11399): at AiForms.Renderers.Droid.PickerCellView.UpdateCell () [0x00006] in :0
10-25 20:16:28.592 I/MonoDroid(11399): at AiForms.Renderers.Droid.CellBaseRenderer1[TnativeCell].GetCellCore (Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context) [0x00046] in <c11b61fab6d348b1b3bb9252504613f0>:0 10-25 20:16:28.592 I/MonoDroid(11399): at Xamarin.Forms.Platform.Android.CellRenderer.GetCell (Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context) [0x00075] in D:\a\1\s\Xamarin.Forms.Platform.Android\Cells\CellRenderer.cs:51 10-25 20:16:28.592 I/MonoDroid(11399): at Xamarin.Forms.Platform.Android.CellFactory.GetCell (Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context, Xamarin.Forms.View view) [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.Android\Cells\CellFactory.cs:20 10-25 20:16:28.592 I/MonoDroid(11399): at AiForms.Renderers.Droid.SettingsViewRecyclerAdapter.BindContentView (AiForms.Renderers.Droid.ContentBodyViewHolder holder, System.Int32 position) [0x00043] in <c11b61fab6d348b1b3bb9252504613f0>:0 10-25 20:16:28.593 I/MonoDroid(11399): at AiForms.Renderers.Droid.SettingsViewRecyclerAdapter.OnBindViewHolder (AndroidX.RecyclerView.Widget.RecyclerView+ViewHolder holder, System.Int32 position) [0x000d3] in <c11b61fab6d348b1b3bb9252504613f0>:0 10-25 20:16:28.593 I/MonoDroid(11399): at AndroidX.RecyclerView.Widget.RecyclerView+Adapter.n_OnBindViewHolder_Landroidx_recyclerview_widget_RecyclerView_ViewHolder_I (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_holder, System.Int32 position) [0x00010] in D:\a\1\s\generated\androidx.recyclerview.recyclerview\obj\Release\monoandroid90\generated\src\AndroidX.RecyclerView.Widget.RecyclerView.cs:425 10-25 20:16:28.593 I/MonoDroid(11399): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.46(intptr,intptr,intptr,int) 10-25 20:16:28.605 E/AppCenterCrashes(11399): Unhandled Exception from source=AndroidEnvironment 10-25 20:16:28.605 E/AppCenterCrashes(11399): System.NullReferenceException: Object reference not set to an instance of an object. 10-25 20:16:28.605 E/AppCenterCrashes(11399): at AiForms.Renderers.PickerCell.GetSelectedItemsText () [0x0015a] in <372a7272679343959209201f0047d05b>:0 10-25 20:16:28.605 E/AppCenterCrashes(11399): at AiForms.Renderers.Droid.PickerCellView.UpdateSelectedItems (System.Boolean force) [0x00079] in <c11b61fab6d348b1b3bb9252504613f0>:0 10-25 20:16:28.605 E/AppCenterCrashes(11399): at AiForms.Renderers.Droid.PickerCellView.UpdateCell () [0x00006] in <c11b61fab6d348b1b3bb9252504613f0>:0 10-25 20:16:28.605 E/AppCenterCrashes(11399): at AiForms.Renderers.Droid.CellBaseRenderer1[TnativeCell].GetCellCore (Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context) [0x00046] in :0
10-25 20:16:28.605 E/AppCenterCrashes(11399): at Xamarin.Forms.Platform.Android.CellRenderer.GetCell (Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context) [0x00075] in D:\a\1\s\Xamarin.Forms.Platform.Android\Cells\CellRenderer.cs:51
10-25 20:16:28.605 E/AppCenterCrashes(11399): at Xamarin.Forms.Platform.Android.CellFactory.GetCell (Xamarin.Forms.Cell item, Android.Views.View convertView, Android.Views.ViewGroup parent, Android.Content.Context context, Xamarin.Forms.View view) [0x0001e] in D:\a\1\s\Xamarin.Forms.Platform.Android\Cells\CellFactory.cs:20
10-25 20:16:28.605 E/AppCenterCrashes(11399): at AiForms.Renderers.Droid.SettingsViewRecyclerAdapter.BindContentView (AiForms.Renderers.Droid.ContentBodyViewHolder holder, System.Int32 position) [0x00043] in :0
10-25 20:16:28.605 E/AppCenterCrashes(11399): at AiForms.Renderers.Droid.SettingsViewRecyclerAdapter.OnBindViewHolder (AndroidX.RecyclerView.Widget.RecyclerView+ViewHolder holder, System.Int32 position) [0x000d3] in :0
10-25 20:16:28.605 E/AppCenterCrashes(11399): at AndroidX.RecyclerView.Widget.RecyclerView+Adapter.n_OnBindViewHolder_Landroidx_recyclerview_widget_RecyclerView_ViewHolder_I (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_holder, System.Int32 position) [0x00010] in D:\a\1\s\generated\androidx.recyclerview.recyclerview\obj\Release\monoandroid90\generated\src\AndroidX.RecyclerView.Widget.RecyclerView.cs:425
10-25 20:16:28.605 E/AppCenterCrashes(11399): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.46(intptr,intptr,intptr,int)
10-25 20:16:28.617 D/Mono (11399): Requesting loading reference 5 (of 6) of /storage/emulated/0/Android/data/se.ceecube.matchup/files/.override/Microsoft.AppCenter.Crashes.dll

Platforms

  • Android
  • iOS

Basic Information

  • AiForms.SettingsView 1.3.3
  • Xamarin.Forms 4.8.0.1560
  • Affected Devices:

Screenshots

Reproduction Link

Workaround

Do not bind to SelectedItem

@mattiasskog
Copy link
Author

Might be related to issue #115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant