Bug 44734 - After updating Xamarin for Visual Studio 2015 this version, our IOS app crashes when navigating one page from another. This problem is only on IOS, Android and UWP don't have this crash.
Summary: After updating Xamarin for Visual Studio 2015 this version, our IOS app crash...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
: 44627 ()
Depends on:
Reported: 2016-09-26 12:38 UTC by Andy Roelandt
Modified: 2016-11-18 22:27 UTC (History)
3 users (show)

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

screenshot from our HockeyApp log (84.14 KB, image/png)
2016-09-26 12:38 UTC, Andy Roelandt
CRASH log file from the Mac (105.46 KB, text/plain)
2016-09-26 12:39 UTC, Andy Roelandt
updated Xamarin this way (80.11 KB, image/png)
2016-10-04 07:36 UTC, Andy Roelandt
"main" navigation mechanism (46.11 KB, image/png)
2016-10-07 08:52 UTC, Andy Roelandt
xam_crsh_status overview (26.59 KB, image/png)
2016-10-07 09:48 UTC, Andy Roelandt
xam_crsh_dossier overview (26.11 KB, image/png)
2016-10-07 09:48 UTC, Andy Roelandt
xam_crsh_dossier detail (31.67 KB, image/png)
2016-10-07 09:49 UTC, Andy Roelandt

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 Andy Roelandt 2016-09-26 12:38:16 UTC
Created attachment 17739 [details]
screenshot from our HockeyApp log


After updating our Visual Studio 2015 Xamarin-environment, our IOS app crashes when we navigate from one page to another and back again.This worked perfectly BEFORE the update. The app also only crashes on IOS, Android and UWP do not crash. 

We use a build Mac where XCODE 8 has been installed on. The crash occurs on Apple's Simulator as well when running  on real devices and is almost "instant"; start app and go from one page to antother= CRASH. We use the MASTER/DETAIL Navigation.

Timing of this crash is very inconvenient because we were supposed to start het APP SUBMISSION to the Apple Store...

Andy Roelandt
Comment 1 Andy Roelandt 2016-09-26 12:39:16 UTC
Created attachment 17740 [details]
CRASH log file from the Mac
Comment 2 Samantha Houts [MSFT] 2016-10-03 18:43:15 UTC
Are you able to share your project with us to help us investigate this issue? Also, did this issue appear after updating Xamarin.Forms, or was it just after updating your Visual Studio Xamarin extension? If you updated Xamarin.Forms, does the issue stop when you downgrade?

Warm regards,
Xamarin Forms Team
Comment 3 Andy Roelandt 2016-10-04 07:36:08 UTC
Created attachment 17855 [details]
updated Xamarin this way


I updated Xamarin For Visual Studio this way....
Comment 4 Andy Roelandt 2016-10-04 07:54:42 UTC
It was indeed AFTER this update that the IOS problem occured. I didn't try to downgrade yet because I'm affraid other things will get broken or I will lose support for IOS 10 that way...

I didn't upgrade my Xamarin For Visual Studio either since I encountered that problem because I'm affraid other things get broken.
Comment 5 Andy Roelandt 2016-10-04 08:09:12 UTC
I would like to give you our VS2015 project but I can't mark my attachment as 'private' in Bugzilla appearantly and mailing it to you ("samantha.houts@xamarin.com") directly is also blocked. 

How can I give you our poject securely and privately?
Comment 7 Andy Roelandt 2016-10-05 07:36:28 UTC
Hi Samantha

Thanks for your quick followup!

If have send you a Dropbox link to a shared folder where you can find the password protected ZIP file. I have send you the needed password via a seperate mail.

Comment 8 Andy Roelandt 2016-10-05 07:38:08 UTC
*** Bug 44627 has been marked as a duplicate of this bug. ***
Comment 9 Samantha Houts [MSFT] 2016-10-06 18:32:20 UTC
@Andy Roelandt 

I can't run your project due to dependencies. However, from looking through your navigation model, it looks like this is the issue.

In many of your ViewModels, you are using this type of code block:

//return to previous view
                    Device.BeginInvokeOnMainThread(() =>
                        MessagingCenter.Send(this, "Navigate", new MasterPageItem { TargetType = typeof(DossiersStatusOverviewPage) });

This is Popping the view from the stack, then sending the navigate message, which is picked up by your MasterDetailPage, which switches the Detail page. Please note that Navigation.PopModalAsync(); is awaitable, but you are not using the await keyword. This means that the Detail page can potentially be switched before the current page is Popped, causing the stack to be out of sync. I believe this is what is happening, and that it is the root cause of this issue.

Please try awaiting all calls to Navigation.PopModalAsync() and let me know if this resolves the issue.
Comment 10 Andy Roelandt 2016-10-07 08:52:39 UTC
Created attachment 17926 [details]
"main" navigation mechanism

screenshot of the "main" navigation mechanism
Comment 11 Andy Roelandt 2016-10-07 09:47:55 UTC
Hi Samantha

Your right about "Navigation.PopModalAsync()" so I implemented it, but the app keeps on crashing in IOS. I was doubtfull that it would fix the crash. 

You see; the app doesn't always make the user login. If the user has set the "Remember Me"-option to TRUE (which is set by default) and he has logged in before, the app immediately starts with an overview of data on top without prompting the user to login again. 

Talking code; the app starts with the "DossiersStatusOverviewPage"-page("DossiersStatusOverviewPageViewModel"-viewmodel) on top. This view displays the different STATUSES a dossier can have and mentions for each how many dossiers are currently in that status, much like you see the #messages you have in all of your different mailboxes inside the IOS Mail-app. 

When you tab one of those statuses, an overview is given of all dossiers having that status. At this point the app crashes imediately when you navigate back to the status overview (first page). 

It is not only here that you can make the app crash. If you don't go back to the overview, but instead you select a dossier from the list and thus navigate to a next view and THEN you try to navigate back => the app crashes. It simply crashes every time you navigate back to the previous page in IOS. 

So in the code: 

- select a STATUS to go to DOSSIER OVERVIEW: DossiersStatusOverviewPageViewModel.OnDossierStatusSelected(..)
- being on DossiersInStatusPage; <navigate back> => crash

- select a STATUS to go to DOSSIER OVERVIEW: DossiersStatusOverviewPageViewModel.OnDossierStatusSelected(..)
- select a DOSSIER from the DOSSIER OVERVIEW:
- being on DossiersDetailPage;<navigate back> => crash

If you look at the attachments:
- I'm on "xam_crsh_status overview.png" and tab "Not yet submitted" ;
- I'm on "xam_crsh_dossier overview.png" and tab "< Overview" top left => crash;

- I'm on "xam_crsh_status overview.png" and tab "Not yet submitted" ;
- I'm on "xam_crsh_dossier overview.png" and tab the first dossiert "ExarteDev, October Ex Arte" ;
- I'm on "xam_crsh_dossier detail.png" an tab "<" top left => crash ;

The crashes only occur in IOS when simply navigating from one view to another, the app doesn't crash on Android nor on UWP.
Comment 12 Andy Roelandt 2016-10-07 09:48:23 UTC
Created attachment 17927 [details]
xam_crsh_status overview

start screen of application
Comment 13 Andy Roelandt 2016-10-07 09:48:52 UTC
Created attachment 17928 [details]
xam_crsh_dossier overview

the dossier overview
Comment 14 Andy Roelandt 2016-10-07 09:49:29 UTC
Created attachment 17929 [details]
xam_crsh_dossier detail

a detail of a dossier
Comment 15 Rui Marinho 2016-10-13 15:55:11 UTC
Hi Andy, spend all day looking at this, as i was unable to reproduce this on a new project in that version.

SO can you try remove the HockeySDK and try again, it stopped crashing for me.. Why.. i m not sure yet
Comment 16 Andy Roelandt 2016-10-17 07:18:07 UTC
Hi Rui, 

Thank you for your work!

I did as you said and removed the HockeyApp integration from the IOS project and for sure; the crashes were gone! For me this solves our problem since we only intended to use the HockeyApp integration during our testing phase.

But like you said; I too find it strange WHY it causes the crashes in the first place....

Thank you!
Andy Roelandt
Comment 17 Rui Marinho 2016-10-17 09:39:20 UTC
Awesome, thanks for the feedback.
Comment 18 Samantha Houts [MSFT] 2016-11-18 22:26:31 UTC
Should be fixed in 2.3.3 stable. Thank you!