Question

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?

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top