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

Getting a null reference exception with iOS, fine with UWP & Android #4

Open
limefrogyank opened this issue Oct 19, 2016 · 3 comments
Assignees

Comments

@limefrogyank
Copy link

limefrogyank commented Oct 19, 2016

I've got both ItemsSource and SelectedItem bound via XAML, with TwoWay binding set on the SelectedItem. As soon as I change the selected item on iOS (just move the scroller), it throws a Null Reference Exception.

My ItemsSource is a List of strings (only three items)

I stepped through your BindablePicker code and couldn't find any obvious flaws leading up to the exception, but I have little knowledge of what's happening under the iOS hood.

The stacktrace shows;
at Xamarin.Forms.Platform.iOS.PickerRenderer.UpdatePickerFromModel (Xamarin.Forms.Platform.iOS.PickerRenderer+PickerSource s) [0x0002f] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\PickerRenderer.cs:111 at Xamarin.Forms.Platform.iOS.PickerRenderer+PickerSource.Selected (UIKit.UIPickerView picker, System.nint row, System.nint component) [0x00054] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\PickerRenderer.cs:180 at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3818/3983064a/source/xamarin-macios/src/UIKit/UIApplication.cs:79 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3818/3983064a/source/xamarin-macios/src/UIKit/UIApplication.cs:63 at AttendanceApp.iOS.Application.Main (System.String[] args) [0x00001] in D:\Sources\attendance\AttendanceApp.iOS\Main.cs:12

I should also probably mention I'm using the preview bits for Xamarin.Forms. (I have no choice as UWP is broken badly in the 'stable' version). On 2.3.3.163-pre3

-Edit
Just tested with mixed assemblies... downgraded the iOS project back to stable Xamarin.Forms and it still throws the error.

@joacar
Copy link
Owner

joacar commented Oct 19, 2016

Thanks for the input. I will (hopefully) have time after office hours today to look at this.

Will keep you posted about my findings.

@joacar joacar self-assigned this Oct 19, 2016
@ivanfranchi
Copy link

Android and iOS fire -SelectedIndexChanged- events in different moments.
I was reassigning the picker in Android for a redraw causing the null reference in iOS.
iOS keeps firing the Index Changed while scrolling the choices

@joacar
Copy link
Owner

joacar commented Jan 20, 2017

I think that is an issue of iOS and is tracked by Xamarin. Yes, found it here and should have found its way in to the later versions of Forms. Which version are you using and could you produce a stack trace?

Also this should be merged into Forms. See this PR

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

No branches or pull requests

3 participants