Created attachment 16283 [details]
I have found an issue where if you have a picker within an Android app, that has AppCompact enabled. Then you tap the picker very rapidly multiple times, as if you were to select an item, multiple dialog windows appear. You can select "Cancel" on every single one, and most of the time the app will remain fine.
The real problem is that if you select an item within the dialog, when multiple windows are present, then the app will crash and throw either a NullReferenceException or a IndexOutOfBoundsException.
I looked into the render to see if there was a problem, and I found that the PickerListener.OnClick function [Line 145] just calls the PickerRenderer.OnClick function [Line 95] which does not preform any check to see if a _dialog window is present. Here is the link to the file that I was looking at: https://github.com/xamarin/Xamarin.Forms/blob/2d9288eee6e6f197364a64308183725e7bd561f9/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs
I have attached a reproduction app that illustrates the problem, the version of Xamarin.Forms in the app is 220.127.116.1182, but the problem does happen in the latest version as well.
*** Bug 42148 has been marked as a duplicate of this bug. ***
Same problem here. Please fix asap.
Should be fixed for 2.3.2-pre.
I have checked this issue with Xamarin.Forms 2.3.2-pre1 and this issue not appear with latest pre version.
Hence close this issue.
If you still facing same issue, Please feel free to reopen this issue or filed new bug for the same.
Created attachment 26133 [details]
The sample which reproduces the breaking of the application while using picker.
While using picker in the project, we get a breaking issue with the following callstack.
Note: We use Xamarin version 18.104.22.1680
01-19 09:14:06.127 I/MonoDroid( 4730): System.NullReferenceException: Object reference not set to an instance of an object.
01-19 09:14:06.127 I/MonoDroid( 4730): at Xamarin.Forms.Platform.Android.PickerRenderer.<OnClick>b__11_2 (System.Object sender, System.EventArgs args) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Renderers\PickerRenderer.cs:145
01-19 09:14:06.127 I/MonoDroid( 4730): at Android.Content.IDialogInterfaceOnDismissListenerImplementor.OnDismiss (Android.Content.IDialogInterface dialog) [0x0000d] in /Users/builder/data/lanes/3511/501e63ce/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Content.IDialogInterface.cs:369
01-19 09:14:06.127 I/MonoDroid( 4730): at Android.Content.IDialogInterfaceOnDismissListenerInvoker.n_OnDismiss_Landroid_content_DialogInterface_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_dialog) [0x00011] in /Users/builder/data/lanes/3511/501e63ce/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Content.IDialogInterface.cs:334
01-19 09:14:06.127 I/MonoDroid( 4730): at (wrapper dynamic-method) System.Object:d5899a9c-5e40-4345-93bc-a7ffc7e4fda1 (intptr,intptr,intptr)
I have attached a sample that replicates the issue.
Procedure to replicate the issue:
1. In DataGrid, tap a column with GridPicker column(3).
2. When picker appear, tap outside anywhere in the datagrid to dismiss or close the picker.
3. With that, please repeat the steps in #2 and do it as fast as you can.
4. In any seconds, the app will crash.