Bug 23560 - Navigating back by gesture causes crash/render issues when gesture is incomplete
Summary: Navigating back by gesture causes crash/render issues when gesture is incomplete
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.2.3
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Seth Rosetter
URL: https://github.com/xamarin/Duplo/issu...
Depends on:
Blocks:
 
Reported: 2014-10-02 16:12 UTC by Sten
Modified: 2016-02-09 18:13 UTC (History)
9 users (show)

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


Attachments
Test Case (22.30 KB, application/zip)
2014-11-18 16:03 UTC, John Miller [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 Sten 2014-10-02 16:12:36 UTC
Scenario (iOS, Xamarin.Forms):
Page1 does Navigation.PushAsync(new Page2());
Page2 is presented to the user.
User drags from the edge of the screen inward, they can see the screen split between Page1 and Page2
User continues dragging back to the edge of the screen so the navigation.Pop did not execute

Case 1:
User taps "< Back" button on the nav toolbar
Page1 renders blank

Case 2:
User repeats the aborted gesture navigation a couple times
User taps "< Back" button
The app crashes with

Unhandled managed exception: The underlying Task is already in one of the three final states: RanToCompletion, Faulted, or Canceled. (System.InvalidOperationException)
	  at System.Threading.Tasks.TaskCompletionSource`1[System.Boolean].SetResult (Boolean result) [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Platform.iOS.NavigationRenderer+<>c__DisplayClass18.<GetAppearedOrDisappearedTask>b__16 (System.Object s, System.EventArgs e) [0x00000] in <filename unknown>:0 
	  at (wrapper delegate-invoke) <Module>:invoke_void_object_EventArgs (object,System.EventArgs)
	  at Xamarin.Forms.Page.SendAppearing () [0x00000] in <filename unknown>:0 
	  at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidAppear (Boolean animated) [0x00000] in <filename unknown>:0 
	  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) [0x00000] in <filename unknown>:0 
	  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] in <filename unknown>:0 
	  at MyApp.iOS.Application.Main (System.String[] args) [0x00000] in <filename unknown>:0
Comment 1 Rajneesh Kumar 2014-10-03 08:23:00 UTC
I have checked this issue and able to reproduce. To reproduce this issue I have followed the instruction provided in bug description.

Steps to reproduce:

1. Create a Xamarin.Forms portable application in XS
2. Add a Xaml page named MyPage
3. Add following code to MyPage.xaml.cs
 public MyPage ()
		{
			//InitializeComponent ();
			var lavel = new Label{ 
				Text="Hello",
				Font=Font.SystemFontOfSize(30)
			};
			var button = new Button {
				Text="Go to second Page"
			};

			button.Clicked += (s, e) => Navigation.PushAsync (new MyPageSecond());
			Content = new StackLayout{ 
				Spacing=10,
				VerticalOptions=LayoutOptions.Center,
				HorizontalOptions=LayoutOptions.Center,
				Children={

					lavel,button
				}
			};
4. Add a Xaml page named MyPageSecond
5. Add following code to MyPageSecond.xaml.cs
public MyPageSecond ()
		{
			//InitializeComponent ();

			var lavel = new Label{ 
				Text="This is second page",
				Font=Font.SystemFontOfSize(30)
			};

			Content = new StackLayout{ 
				Spacing=10,
				VerticalOptions=LayoutOptions.Center,
				Children={

					lavel
				}
			};
6. Call "MyPage" in App.cs and run the application on device
7. Drags from the edge of the screen inward, they can see the screen split between Page1 and Page2
8. User continues dragging back to the edge of the screen so the navigation.Pop did not execute
9. Observe  the following cases

Case 1:
User taps "< Back" button on the nav toolbar
Page1 renders blank

Case 2:
User repeats the aborted gesture navigation a couple times
User taps "< Back" button
The app crashes with following exception:

Exception: https://gist.github.com/Rajneesh360Logica/732a4295b84d02a9870b

Additional Information: Getting same behavior on device and simulator.

Screencast: http://www.screencast.com/t/pF1g2lUaqC

Environment Info:

=== Xamarin Studio ===

Version 5.4 (build 240)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
	Mono 3.8.0 ((no/db71bc1)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 308000013

=== Xamarin.Android ===

Version: 4.16.0 (Enterprise Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		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)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.iOS ===

Version: 8.0.0.63 (Enterprise Edition)
Hash: 58b46df
Branch: 
Build date: 2014-09-18 22:32:07-0400

=== Xamarin.Mac ===

Version: 1.10.0.13 (Starter Edition)

=== 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 MacMini.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 Vratislav Kalenda 2014-10-14 09:33:11 UTC
Hello, is there any progress on this issue or any known workaround beside disabling the gesture in custom renderer? This issue is blocking our app release.
Comment 3 John Miller [MSFT] 2014-11-18 16:03:04 UTC
Created attachment 8791 [details]
Test Case

Attached a test case from another case where a similar issue is happening, with similar crash report / stacktrace.
Comment 6 Seth Rosetter 2015-05-29 13:59:27 UTC
Hi all,

I was able to reproduce the issue with the attached reproduction which references Xamarin.Forms 1.2.3. After updating to our current stable (1.4.2), the issue seems to be resolved. 

Thanks!

- Seth
Comment 7 Rajneesh Kumar 2015-06-02 14:56:03 UTC
I have checked this issue with the following builds:

Xamarin.Forms Version: 1.4.3.6358-pre2
Xamarin Studio Version 5.9.2 (build 2)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Runtime:
Mono 4.0.0 ((detached/d136b79)
GTK+ 2.24.23 (Raleigh theme)
rin.Android Version: 5.1.2.1 (Business Edition)
Operating System Mac OS X 10.9.5
Darwin MacMini.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

I have checked this issue with the help of sample provided in the comment 3, and I was able to reproduce this issue with XF 1.2.3, but it was little bit heavily to reproduce.

I observed that this issue does not exist with Xamarin.Forms Version: 1.4.3.6358-pre2. Now, I am not getting any exception or blank page on swiping between pages.

Screencast: http://www.screencast.com/t/2GUMfvm9Eb

This issue seems to fixed , hence as of now closing this issue if someone face this issue again so feel free to reopen this issue.

Thanks..!
Comment 11 Paul DiPietro [MSFT] 2016-02-09 18:13:35 UTC
Tested with 2.1-pre4 and it isn't occurring using the test reproduction.