Solution found. The simple answer: I didn’t properly manipulate the navigation stack. According to VincentH_NET's answer, I would have to do what I originally tried to do, but due to an error in Xamarin I cannot. Here is the situation:
The application starts only from the main page in the navigation stack, which I will denote with M
[ M
When interacting with the user, I first push the loading screen, indicated by L
, onto the navigation stack, while I am preparing the barcode scan page.
[ M, L
Once the scan page is ready, I automatically drag the user forward, leaving the navigation stack as follows:
[ M, L, S
The user now scans a QR code containing search information. After they successfully scan the code, I bring them back to the boot screen (which is now reassigned to the boot screen when I make server requests for my data).
[ M, L
After I downloaded the relevant information from the QR code, I click them in the form of a list of data, page D
[ M, L, D
At this point, I tried to remove the L
loading page from the navigation stack using Navigation.RemovePage();
, since the download page is no longer needed and will be confused if the user clicks the back button to see the download screen, which is not loading anything. I wanted a navigation stack that looked like this:
[ M, D
But instead, it seems that deleting my page damaged the navigation stack, which led to the errors I experienced.
My solution now is to instead of trying to remove the download page from the stack, to automatically load the download page from the stack if it does not actually load anything.
PS if anyone has a deeper understanding of this problem or is better than best practice for these types of user interfaces, I would love to hear your answers.