Bug 46195 - Navigation Stack Errors in Xamarin.Forms.2.3.3.163-pre3
Summary: Navigation Stack Errors in Xamarin.Forms.2.3.3.163-pre3
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms (show other bugs)
Version: 2.3.3
Hardware: Other Other
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
: 44560 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-10-31 23:07 UTC by Luke
Modified: 2017-02-15 22:43 UTC (History)
8 users (show)

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


Attachments

Description Luke 2016-10-31 23:07:29 UTC
This bug affects Xamarin.Forms.2.3.3.163-pre3. Xamarin.Forms.2.3.3.163-pre2 and prior are not affected.

Using the sample XF app I am setting MainPage to new NavigationPage(new XamarinTestPage()) and on XamarinTestPage I have a button that Navigation.PushAsync(new ContentPage());

When you use the back button on the ContentPage to return to the XamarinTestPage the following exception is thrown.

*** Terminating app due to uncaught exception 'System.AggregateException', reason: 'System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. ---> System.NotSupportedException: Popped page does not appear on top of current navigation stack, please file a bug. at Xamarin.Forms.Platform.iOS.NavigationRenderer+<OnPopViewAsync>d__41.MoveNext () [0x0005e] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:291 --- End of inner exception stack trace --- ---> (Inner Exception #0) System.NotSupportedException: Popped page does not appear on top of current navigation stack, please file a bug. at Xamarin.Forms.Platform.iOS.NavigationRenderer+<OnPopViewAsync>d__41.MoveNext () [0x0005e] in C:\BuildAgent2\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:291 <--- '

Please note that this exception is only visible when some sort of crash logging like HockeyApp or Crashlytics is included. When these are included the app terminates immediately with the following stack trace.

Thread 5 Crashed:: Finalizer
0   libsystem_kernel.dylib              0x0c8fc49a __pthread_kill + 10
1   libsystem_pthread.dylib             0x0c92dec3 pthread_kill + 90
2   libsystem_c.dylib                   0x0c68f11f abort + 141
3   com.sisailmahuolto.tyomaarain       0x000a2b45 uncaught_exception_handler + 38
4   com.apple.CoreFoundation            0x0aa60269 __handleUncaughtException + 809
5   libobjc.A.dylib                     0x0b477103 _objc_terminate() + 100
6   com.sisailmahuolto.tyomaarain       0x00086574 BITCrashUncaughtCXXTerminateHandler() + 867 (BITCrashCXXExceptionHandler.mm:181)
7   libc++abi.dylib                     0x0b45f6c1 std::__terminate(void (*)()) + 14
8   libc++abi.dylib                     0x0b45f0e3 __cxa_throw + 122
9   libobjc.A.dylib                     0x0b476f83 objc_exception_throw + 337
10  libxamarin-debug.dylib              0x0b23c8fb xamarin_process_nsexception_using_mode + 315
11  libxamarin-debug.dylib              0x0b23c7b4 xamarin_process_nsexception + 36
12  libxamarin-debug.dylib              0x0b24a075 xamarin_dyn_objc_msgSend + 149
13  ???                                 0x22a2fb60 0 + 581106528
14  ???                                 0x22a2bd78 0 + 581090680
15  ???                                 0x22a2ba3c 0 + 581089852
16  ???                                 0x22a2b978 0 + 581089656
17  ???                                 0x22a2b8b5 0 + 581089461
18  ???                                 0x22a2acb8 0 + 581086392
19  ???                                 0x22717455 0 + 577860693
20  libmonosgen-2.0.dylib               0x0afa1e54 mono_gc_run_finalize + 1092
21  libmonosgen-2.0.dylib               0x0afdece9 sgen_client_run_finalize + 25
22  libmonosgen-2.0.dylib               0x0afee7d4 sgen_gc_invoke_finalizers + 292
23  libmonosgen-2.0.dylib               0x0afa3235 finalizer_thread + 597
24  libmonosgen-2.0.dylib               0x0af7b6af start_wrapper + 575
25  libmonosgen-2.0.dylib               0x0b04370a inner_start_thread + 458
26  libsystem_pthread.dylib             0x0c92b10b _pthread_body + 184
27  libsystem_pthread.dylib             0x0c92b053 _pthread_start + 243
28  libsystem_pthread.dylib             0x0c92a92e thread_start + 34

If bug reporting packages aren't included this bug happens in the background silently. It really needs to be fixed when bug reporters are present however, it could end up leading to something more sinister.
Comment 1 Joas 2016-11-01 17:44:19 UTC
What happens when you add a Exception Catchpoint (On System.Exception) without including "crash logging like HockeyApp or Crashlytics".

In one of my projects, it breaks on the Exception, but doesn't crash if I continue. With HockeyApp 'on' it does crash after catching the Exception.
Comment 2 Oxana 2016-11-14 19:17:55 UTC
+1 here, the same stack trace.
Oh, I was so excited about pre-4 because of fix https://bugzilla.xamarin.com/show_bug.cgi?id=44338 in there. Now I have to choose - either context actions crash or broken navigation.
After some research I figured out that exception occurs even in pre-2 in my case. Only stable 2.3.2.127 works fine. 
Really hope this will be fixed soon.
Comment 3 Samantha Houts [MSFT] 2016-11-18 22:20:59 UTC
Should be fixed in 2.3.3 stable. Thank you!
Comment 4 Samantha Houts [MSFT] 2016-12-19 19:43:40 UTC
*** Bug 44560 has been marked as a duplicate of this bug. ***
Comment 5 Rod Sanford 2017-02-07 13:16:50 UTC
This seems to have raised its ugly head again in version 2.3.3.180.  I commented out the HockeyApp initialization code in AppDelegate.cs and the application will navigate again without error...re-establish the code, and it fails with the above System.AggregateException.
Comment 6 Rod Sanford 2017-02-07 15:01:51 UTC
Actually, I take that back...I updated from HockeyApp.iOS 4.1.0.3 to the most recent HockeySDK.Xamarin in NuGet, 4.1.1, and it fixed the issue. Carry on...nothing to see here.
Comment 7 Stefanica Stefan 2017-02-11 12:40:09 UTC
I have the same error. Updating HockeySDK to the latest version didn't change anything...
Comment 8 Samantha Houts [MSFT] 2017-02-15 18:27:11 UTC
@Stefanica Are you using 2.3.3 stable?

Note You need to log in before you can comment on or make changes to this bug.