Bug 41717 - Picker allows multiple dialogs to be open causing the app to crash
Summary: Picker allows multiple dialogs to be open causing the app to crash
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android (show other bugs)
Version: 2.2.0
Hardware: PC Windows
: Normal major
Target Milestone: ---
Assignee: Bugzilla
URL:
: 42148 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-06-10 18:14 UTC by c.krempp91
Modified: 2018-01-29 13:15 UTC (History)
8 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:


Attachments
Reproduction project (273.48 KB, application/x-zip-compressed)
2016-06-10 18:14 UTC, c.krempp91
Details
The sample which reproduces the breaking of the application while using picker. (336.30 KB, application/x-zip-compressed)
2018-01-29 13:15 UTC, shivagurunathan
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
VERIFIED FIXED

Description c.krempp91 2016-06-10 18:14:37 UTC
Created attachment 16283 [details]
Reproduction project

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 2.0.0.6482, but the problem does happen in the latest version as well.
Comment 1 Samantha Houts [MSFT] 2016-06-24 17:16:40 UTC
*** Bug 42148 has been marked as a duplicate of this bug. ***
Comment 2 Toni L. 2016-07-14 10:36:40 UTC
Same problem here. Please fix asap.
Comment 3 Paul DiPietro [MSFT] 2016-07-18 23:29:21 UTC
Should be fixed for 2.3.2-pre.
Comment 4 Parmendra Kumar 2016-08-08 15:04:30 UTC
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.

Thanks.
Comment 5 shivagurunathan 2018-01-29 13:15:30 UTC
Created attachment 26133 [details]
The sample which reproduces the breaking of the application while using picker.

Hi ,

While using picker in the project, we get a breaking issue with the following callstack.

Note: We use Xamarin version 2.4.0.280

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.

Regards,
Shivagurunathan. K