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.
On WinPhone 8.1 RT (running in emulator - as currently have a deployment issue to physical 8.1 phones), if a DisplayAlert is shown and the user attempts to close the Alert using the keyboard, the keystroke is not handled by the Alert and instead goes to the page that opened the Alert. In my case, this is resulting in the keystroke activating a button on the page underneath, which unfortunately calls DisplayAlert a second time, with an exception resulting.
The exception is:
"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
--- End of stack trace from previous location where exception was thrown ---
I suspect the exception is a result of DisplayAlert being called twice. However, the cause of that happening is that the dialog that appears when DisplayAlert is called does not handle keyboard use. In this case, I am using the keyboard as I am working with the emulator, but I would assume that this same problem would occur if using a Bluetooth keyboard with my mobile device.
The code that demonstrates the problem is simply the following:
private async void OnCommand()
await DisplayAlert("Title", "Message", "Cancel");
which I trigger by pressing the button defined below:
Button displayAlertButton = new Button
Text = "Display Alert",
Command = new DelegateCommand(OnCommand)
When an Alert is displayed, the focus should be passed to the Alert (ideally to the first button on the Alert) rather than remaining on the underlying page.
Note that the keypress going to the underlying page instead of the Alert is not limited to WinPhone 8.1 RT.
The exception caused by displaying multiple Alerts should be resolved in 2.3.4: https://github.com/xamarin/Xamarin.Forms/pull/347
I was also not able to reproduce the behavior where the keyboard input was activating the button on the page beneath the Alert. I tested with the Popups sample on a W10 mobile emulator using Forms 220.127.116.11 and 2.3.4-pre6. With the Alert open, pressing Enter on the keyboard would activate the Button on the Alert itself. I could also press Tab to switch focus between the "Accept" and "Cancel" buttons if both were present in the Alert.
If you are still experiencing this issue with Forms 2.3.4-pre6 or later, please reopen this issue and include which emulator you are testing with and specific repro steps. Thanks!
It was still a problem in 18.104.22.168 . I will re-test when I upgrade to 2.3.4
The emulator is "Emulator 8.1 1080P 6 inch", running on a 64 bit Windows 10 PC.
The code used has a Button on a ContentPage. When the Button is pressed, DisplayAlert is called. Hitting space or Enter activates the Button on the ContentPage, not the button on the alert.