This is a re-opening of the following bug:
https://github.com/xamarin/Xamarin.Forms/issues/7661
This fix was pulled into 4.2 but never released in 4.2 but seems to be present in 4.3.x builds.
Put the app into the background and resume the application. Within the OnResume method try to set the mainpage to a new mainpage (navigation page), iOS works fine, goes to the new main page, but Android app is frozen with all navigation broken.
Steps to Reproduce
Launch app in Droid Emulator
Push app to back ground
Resume app after a few seconds and set the main page to a new page, the app should navigate to the new main page but instead it is frozen with all navigation broken
The application should navigate to the new main page after it has resumed.
The application is frozen with all navigation broken.
See previous issue:
https://github.com/xamarin/Xamarin.Forms/issues/7661
This fix was pulled into 4.2 but never released in 4.2 but seems to be present in 4.3.x builds.
The last service release of 4.2.0 had it. 4.2.0.910310.
And it's definitely re-broken in 4.3.0 and the latest 4.4.0 pre-release. :(
Is anyone actually doing anything with this bug?
I can't believe nothing has happened with it despite it being a major issue.
Same issue
@samhouts just out of interest has anyone checked the current stable versions of Xamarin Forms e.g. 4.5 to see if they have the issue?
I'm confused by the sample app.
The sample app is setting the MainPage to the ItemsPage so why would you expect that it's able to navigate?
```C#
MainPage = new ItemsPage();
If you change it to
```C#
MainPage = new NavigationPage(new ItemsPage());
then it's able to navigate without any issues. I tested this on the latest nightly and it works fine.
Let me know if I'm misinterpreting the sample and I'll reopen
@PureWeen I think you've missed the point here.
Please look back at the scenario and through the history and the related issue. I didn't supply the original sample app it was provided with the linked issue when the problem was first reported in 4.2.
The bug has been verified as a bug by @hartez and as a high priority issue (see the history), it's been broken since 4.2, it's broken in 4.3, it was broken in 4.4 and it's probably still broken.
It's taken ages for this to filter through the dev process (even though its high priority) so just closing it because you've got a query over the the sample app probably means it's not going to get any traction for months again.
The issue is about replacing the MainPage property after the app has resumed from the background. Replacing the MainPage property with a new navigation page or with a new page prevents the new page from being shown and leaves the app unresponsive.
Please re-open and fix asap.
Here's the scenario:
Consider an app that needs to ensure a user is logged out after a period of inactivity e.g. an banking app or a credit card app. You'll probably have some login page and then some main user landing page once logged in. Login pages and main pages tend to be using different navigation (you don't want to navigate back to the login page).
Once a user has logged in, imagine the MainPage property is now set to the user's main dashboard page (probably has its own nav too). The user puts the app into the background and then resumes it 5 mins later. When the application is resumed it detects that its been asleep for more that the allowed time so it has to log the user out. The app cleans up any user session and then attempts to restore the login page as the MainPage. At this point when attempting to replace the MainPage of the app it freezes, the login page does not get displayed and all you can do it kill the app because its unresponsive.
@samhouts can you please re-open this issue?
@PureWeen please take care in understanding issues before you close them. We've been tracking this problem since mid-November 2019. We are stuck on XF 4.0.x because of it.
We have the exact issue @WilkoSki described in https://github.com/xamarin/Xamarin.Forms/issues/8151#issuecomment-593375038. The Android app shows a blank white screen and is unresponsive when the app is resumed if they are signed out due to inactivity and the app navigates to the login screen.
It is frankly embarrassing at this point to continue having to tell the client this showstopper issue is still not resolved.
I'm probably just following the breadcrumbs poorly
But here's the app I'm testing updated to 4.5.
I changed the resume code to use
MainPage = new NavigationPage(new ItemsPage());
Because that's the only way you're going to get navigation after resume
Here's a video of me following the instructions I found to recreate
You'll notice the hamburger disappears on resume which indicates the shell page is being swapped out for the ItemsPage
Following up on this, I did some testing with your sample app and also could not repro the issue. Also, our app no longer signs the user out after a period of inactivity, so it isn't easy to retest the issue with our app. @WilkoSki do you still see this issue?
I've now upgraded our app to XF 4.5 (made no code changes) and can confirm that the issue appears to have been resolved.
Most helpful comment
Is anyone actually doing anything with this bug?
I can't believe nothing has happened with it despite it being a major issue.