Bug 23358 - ActionSheet crashes after selecting option on iPad.
Summary: ActionSheet crashes after selecting option on iPad.
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.2
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2014-09-24 21:01 UTC by Jon Goldberger [MSFT]
Modified: 2014-10-01 15:12 UTC (History)
6 users (show)

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


Attachments
Test project (23.70 KB, application/zip)
2014-09-24 21:01 UTC, Jon Goldberger [MSFT]
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:
RESOLVED FIXED

Description Jon Goldberger [MSFT] 2014-09-24 21:01:27 UTC
Created attachment 8179 [details]
Test project

App crashes on iPad when returning from an ActionSheet. 

## Steps to reproduce

1. Open the attached test project and restore the packages
2. Launch the iOS project to an iPad or iPad simulator. 
3. Click the Display Action Sheet button.
4. Select any button on the action sheet.

## Expected result

App will return to main UI and response is written to console.

## Actual result

App crashes with below stack trace after the response is written to the console. 

## Stack trace:

System.InvalidOperationException: The underlying Task is already in one of the three final states: RanToCompletion, Faulted, or Canceled.
  at System.Threading.Tasks.TaskCompletionSource`1[System.String].ThrowInvalidException () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs:91
  at System.Threading.Tasks.TaskCompletionSource`1[System.String].SetResult (System.String result) [0x0000c] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs:86
  at Xamarin.Forms.ActionSheetArguments.SetResult (System.String result) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.Platform+<>c__DisplayClassc.<.ctor>b__5 (System.Object o, MonoTouch.UIKit.UIButtonEventArgs args) [0x00000] in <filename unknown>:0
  at MonoTouch.UIKit.UIActionSheet+_UIActionSheetDelegate.Clicked (MonoTouch.UIKit.UIActionSheet actionSheet, Int32 buttonIndex) [0x00014] in /Developer/MonoTouch/Source/monotouch/src/build/compat/UIKit/UIActionSheet.g.cs:503
  at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:46
  at FormsActionSheetiPad.iOS.Application.Main (System.String[] args) [0x00008] in /Users/apple/git/XamarinSupportSamples/FormsActionSheetiPad/iOS/Main.cs:17


## Version information

Xamarin.Forms 1.2.2.6243 (tested with Xamarin.Forms 1.2.3.6255-pre3 also)

=== Xamarin Studio ===

Version 5.4 (build 240)
Installation UUID: 2dc9022f-f9a8-424f-8284-bf224cbbfde0
Runtime:
	Mono 3.8.0 ((no/45d0ba1)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 308000009

=== Xamarin.Android ===

Version: 4.16.0 (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.2   (API level 8)
		2.3   (API level 10)
		3.0   (API level 11)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.Mac ===

Version: 1.10.0.13 (Business Edition)

=== Xamarin.iOS ===

Version: 8.0.0.62 (Business Edition)
Hash: 8bd8158
Branch: 
Build date: 2014-09-18 09:12:55-0400

=== Build Information ===

Release ID: 504000240
Git revision: 01786bc67c7024ec33d327ed27e4416d7a846f4e
Build date: 2014-09-17 10:58:48-04
Xamarin addins: 7cd7dfcd6b7b7b53281508954ec080f1cd153ad3

=== Operating System ===

Mac OS X 10.9.5
Darwin Jonathans-MacBook-Pro.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 Eric Maupin 2014-09-24 21:35:37 UTC
Was this on iOS 8?
Comment 3 rfreschi 2014-09-25 13:27:18 UTC
Yes.
The error is occurring on the new iPad simulators included with the latest XCode 6 update.

It is not happening on a iPad running 7.1.2. 

However, the  "Cancel" button appears on phones but not pads.  
Sample call:
var action = await DisplayActionSheet("Select Lab Date", "Cancel", null, DistinctLabDates.ToArray());
Comment 4 Eric Maupin 2014-09-25 16:47:49 UTC
Fixed for next update.
Comment 5 Sten 2014-10-01 15:12:54 UTC
This bug is either not resolved or the resolution is not yet deployed in an update (beta channel tested).

There is a different behavior at this moment, the app doesn't crash but 

var response = await DisplayActionSheet(...) 

never receives the response on iPad simulator