1

My app is failing at the "Debugger.Break" here:

private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
    if (Debugger.IsAttached)
    {
        // A navigation has failed; break into the debugger
        Debugger.Break();
    }
}

...and I get: "System.Reflection.TargetInvocationException was unhandled Message: An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in System.Windows.ni.dll"

My code is very simple so far. I simply have a HyperlinkButton on the main page that tries to navigate to another page:

//winrt-xaml:
        <HyperlinkButton x:Name="hyperlinkButtonManageInvitations" Margin="24" Grid.Row="1" Tap="HyperlinkButtonManageInvitations_OnTap">Manage Invitations</HyperlinkButton>

//C# code-behind:

private void HyperlinkButtonManageInvitations_OnTap(object sender, GestureEventArgs e)
{
    NavigationService.Navigate(
        new Uri("//TaSLs_Pages/InvitationManagePage.xaml", UriKind.Relative));
}

I did use Resharper to move MainPage.xaml (and *.cs) into my TaSLs_Pages subfolder; that wouldn't be a problem, would it?

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • does the error come when you hit the Hyperlink Button? Or when starting the app? – Jim O'Neil Dec 26 '12 at 19:53
  • It's before the Hyperlink button is pressed; I put a breakpoint there, and it's not reached. – B. Clay Shannon-B. Crow Raven Dec 26 '12 at 20:38
  • I used Resharper to move MainPage back up out of my "Pages" subfolder, and the main page now displays again. However, I still get to Debugger.Break, first in RootFrame_NavigationFailed() and then Application_UnhandledException(). – B. Clay Shannon-B. Crow Raven Dec 26 '12 at 22:16
  • 2
    When you moved the MainPage, I suspect Resharper isn't aware that the WMAppManifest.xml needs to be updated to reflect the path to the new Navigation Page... now that you've moved it back though, unsure. When you get Debugger.Break, check the Exception property of the argument 'e' in NavigationFailed, that should have more salient information for you. – Jim O'Neil Dec 26 '12 at 22:35
  • 1
    Got it working, thanks, Jim; it ended up being a stinkin' typo in my page name! argghhh... – B. Clay Shannon-B. Crow Raven Dec 26 '12 at 22:40

1 Answers1

1

Check NavigationFailedEventArgs. You can check the exception by e.Exception.Message

Bibaswann Bandyopadhyay
  • 3,389
  • 2
  • 31
  • 30