Bug 23345 - System.InvalidOperationException thrown when selecting cancel/dismiss button on DisplayAlert
Summary: System.InvalidOperationException thrown when selecting cancel/dismiss button ...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-09-24 11:35 UTC by Allie Miller
Modified: 2014-09-25 20:16 UTC (History)
6 users (show)

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

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:

Description Allie Miller 2014-09-24 11:35:47 UTC
Using the DisplayAlert method on pages using the NavigationPage as a wrapper results in a "System.InvalidOperation" exception when the "cancel" button is selected. 

Steps to reproduce
1) In the attached project, select the "reset password" button on the login page. 
2) On the reset password page, select the "reset password" button without entering any information into the username text field.
3) When the alert appears saying that the username is required, select the dismiss button on the alert.

Expected results
The user is brought back to the reset password page to enter their username to reset their password.

Actual results
The application crashes with the following error:

System.InvalidOperationException was unhandled
Message: An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.ni.dll
Additional information: An attempt was made to transition a task to a final state when it had already completed.

Additional information
The code works for the reported user in iOS and Android. The exception also does not occur when using Display alert on the login page. 

Versioning information
Microsoft Visual Studio 2013
Version 12.0.30723.00 Update 3
Xamarin Forms 1.2.26243
Comment 2 Jon Goldberger [MSFT] 2014-09-24 21:09:59 UTC
Possibly related bug: https://bugzilla.xamarin.com/show_bug.cgi?id=23358
Comment 3 Eric Maupin 2014-09-25 20:16:03 UTC
Fixed for next update.