Dimitris Makris
Dimitris Makris

Reputation: 5183

Navigation to new Page fails: Automatically returns to previous page on Windows Phone 8

I have created a Pivot app, launch HomePage and using a Button, I navigate to a new blank page.

private void Forgot_Password_Click(object sender, RoutedEventArgs e)
{
    NavigationService.Navigate(new Uri("/ForgotPasswordPage.xaml", UriKind.Relative));
}

The new page is shown, but after a while, it terminates and returns back the previous page. I also get the following error:

The thread 0x990 has exited with code 259 (0x103).

Has anyone experienced a similar behaviour?

However, if I start this page directly (ForgotPasswordPage) (instead of HomePage), it starts normally.

UPDATED:

I noticed that this happens to any page I navigate from the the page with the Pivot control. Does this has any connection with the problem?

UPDATED #2:

I tried the following flow: Let's assume I have the following Pages:

I start MainPage and then using an action on the app bar I navigate to Home Page. Everything is ok so far. Then using a button I navigate to LoginPage which is a simple blank Page. After a while this Page terminates and I automatically return to Home Page.

Then I tried to start LoginPage from MainPage. The Login Page starts normally but after few seconds it terminates and I return to the HomePage which I had never navigated to!!!!

Does this help to understand what goes so wrong?

UPDATED #3

I setup the whole project from the beginning and then started adding the code from the previous project. I found that this behaviour was generated due a DispatchTimer I had, which I had never stopped. Fixed it and now the problem is solved. Thank you all for your help.

Thanks in advance!

Upvotes: 2

Views: 201

Answers (1)

csharpwinphonexaml
csharpwinphonexaml

Reputation: 3683

The problem appeard to be a DispatchTimer that keeped running as user updated in the question.

UPDATED #3

I setup the whole project from the beginning and then started adding the code from the previous project. I found that this behaviour was generated due a DispatchTimer I had, which I had never stopped. Fixed it and now the problem is solved.

The solution to this specific issue would be to manage carefully any long running operations inside your application.

Upvotes: 3

Related Questions