Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
# Steps to reproduce
List<string> myitems= await GetMyItemsAsync();
foreach (string item in myitems)
# Expected behavior
# Actual behavior
Message=Value does not fall within the expected range.
at Windows.UI.Xaml.Controls.Primitives.Selector.put_SelectedIndex(Int32 value)
at Xamarin.Forms.Platform.UWP.PickerRenderer.OnElementPropertyChanged(Object sender, PropertyChangedEventArgs e)
at System.ComponentModel.PropertyChangedEventHandler.Invoke(Object sender, PropertyChangedEventArgs e)
at Xamarin.Forms.BindableObject.OnPropertyChanged(String propertyName)
at Xamarin.Forms.Element.OnPropertyChanged(String propertyName)
at Xamarin.Forms.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent)
at Xamarin.Forms.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes)
at Xamarin.Forms.BindableObject.SetValue(BindableProperty property, Object value, Boolean fromStyle, Boolean checkAccess)
at Xamarin.Forms.Picker.set_SelectedIndex(Int32 value)
at QvmXF.Helper.OptionPicker`1.set_SelectedItem(T value)
# Supplemental info (logs, images, videos)
# Test environment (full version information)
this was working with 2.3.3, its a new bug with Forms.UWP 2.3.4
its also fine with Forms.Android and Forms.iOS
correction: its also not working with Forms.Android anymore
didn't check iOs now, but Picker is messed up with 2.3.4 in combination with async.
going back to 2.3.3. everything is fine.
Created attachment 19372 [details]
I believe I'm seeing the same issue described in comment 0 as I get the following stack trace: https://gist.github.com/jimmgarrido/6b4916bdc98f089180d5b1318a2ea268
However I think the real issue is that there are no items in the Picker which is why the exception is thrown when trying to set the SelectedIndex. Opening the Picker on UWP shows no items even though the debugger says that the Picker.Items is populated. I've attached a sample project that demonstrates this.
In the sample project the items are added to the picker in the page's OnAppearing() method. Interestingly though, the items _do_ appear if they are added in the constructor instead. If you add items in both areas, then only the ones from the constructor are visible. Also, the sample project does not use async/await so that might not be related to the issue as originally reported.
### Regression Status
This issue does _not_ happen with Forms 220.127.116.11 when the items are added in OnAppearing()
### Platforms Affected
I am only seeing this issue on UWP/WinRT unlike mentioned in comment 1. If the issue does exist in Android/iOS another project will need to be added reproduces the issue on those platforms.
Possible duplicate of bug 51642
Bug 51642 is a separate report for the items not displaying in the Picker which seems to be cause of the crash in this report.
*** This bug has been marked as a duplicate of bug 51642 ***