2

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:

  • MainPage
  • HomePage (this is the one with the pivot)
  • LoginPage

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!

Sean McKenna
  • 3,706
  • 19
  • 19
Dimitris Makris
  • 5,183
  • 2
  • 34
  • 54
  • Interesting. Does this happen on both the emulator and the device? – fillobotto May 23 '14 at 21:17
  • I haven't tested on device yet. I run Visual Studio Express for Windows on Windows 8.1 running on VMWare Fusion 5. – Dimitris Makris May 23 '14 at 21:19
  • Does it happen also on WP8.1 (you tagged it)? Does it happen when you navigate from Page without Pivot control? – Romasz May 24 '14 at 06:51
  • I have not tried WP8.1 yet. Please check updated answer for a strange flow I get. – Dimitris Makris May 24 '14 at 11:29
  • Check also if there isn't something strange in `App.xaml.cs`. Set few breakpoints and see how navigation goes. And as suggested above, if possible try on a device. You can also share a code so it would be possible to check on other device/computer. – Romasz May 24 '14 at 13:28

1 Answers1

3

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.

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
csharpwinphonexaml
  • 3,659
  • 10
  • 32
  • 63