-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Issue1723.cs
57 lines (48 loc) · 1.3 KB
/
Issue1723.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github5000)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 1723, "Picker's Items.Clear cause exception", PlatformAffected.WinPhone, NavigationBehavior.PushModalAsync)]
public class Issue1723
: ContentPage
{
Picker _picker = null;
public Issue1723()
{
StackLayout layout = new StackLayout();
Content = layout;
_picker = new Picker();
layout.Children.Add(_picker);
Button button = new Button();
button.Clicked += button_Clicked;
button.Text = "prepare magic";
layout.Children.Add(button);
}
void button_Clicked(object sender, EventArgs e)
{
Random r = new Random();
_picker.Items.Clear();
for (int j = 0; j < r.Next(10, 30); j++)
{
StringBuilder sb = new StringBuilder();
for (int k = 10; k < r.Next(15, 35); k++)
{
sb.Append((char)r.Next(65, 90));
}
_picker.Items.Add(sb.ToString());
}
_picker.SelectedIndex = r.Next(0, _picker.Items.Count);
Button button = (Button)sender;
button.Text = "crash the magic";
}
}
}