0

i can't figure out, why my App crashes or closes (it just quits, no break in debug-mode)

i try to navigate to another view, there are two possibilities, one works, the second causes the Crash:

        private void Nachricht_EventClickTelMac_Mac(object sender, RoutedEventArgs e)
    {
        //MenuFlyoutItem mfi = sender as MenuFlyoutItem;
        //GeräteAuslesenNavigationParameter p = new GeräteAuslesenNavigationParameter();
        //p.MacAdressen = new List<string>();
        //p.AuftragId = _viewmodel.Auftrag.auftrag_id;
        //p.KundenNummer="";
        //p.MacAdressen.Add((string)mfi.CommandParameter);
        //mfi = null;
        //sender = null;
        Frame.Navigate(typeof(GeräteAuslesen), null);
    }
    private void KundenwerteAuslesen(object sender, RoutedEventArgs e)
    {
        //GeräteAuslesenNavigationParameter p = new GeräteAuslesenNavigationParameter();
        //p.KundenNummer = _viewmodel.Auftrag.kunden_nr.ToString();
        //p.AuftragId = _viewmodel.Auftrag.auftrag_id;
        //p.MacAdressen = new List<string>();
        Frame.Navigate(typeof(GeräteAuslesen), null);
    }

I've commented out all differences, so the only difference is the Sender

KundenwerteAuslesen works well, Nachricht_EventClickTelMac_Mac leads to the Crash ... you can see the elements of the desired view flying in for about half a second, then the app Closes

does anybody have a clue whats going on?

Are the lines of code commented out when you observe the crash? and what event is calling those methods? (i.e. a button click?) – erotavlas 3 mins ago

yea it is commented out, because i wanted to know if the Problem is in These lines, but it isn't

this is the method calling Nachricht_EventClickTelMac_Mac:

        private void Nachricht_EventClickTelMac(Hyperlink arg1, string arg2)
    {
        MenuFlyout fl = new MenuFlyout();

        MenuFlyoutItem mfi1 = new MenuFlyoutItem();
        mfi1.Text = "Telefonnummer Anrufen";
        mfi1.Click += Nachricht_EventClickTelMac_Tel;
        mfi1.CommandParameter = arg2;

        MenuFlyoutItem mfi2 = new MenuFlyoutItem();
        mfi2.Text = "Mac-Adresse auslesen";
        mfi2.Click += Nachricht_EventClickTelMac_Mac;
        mfi2.CommandParameter = arg2;

        fl.Items.Add(mfi1);
        fl.Items.Add(mfi2);
        fl.ShowAt(Frame);
    }

and this is the XAML calling KundenwerteAuslesen:

<AppBarButton x:Key="abb_equip_auslesen" Label="Kundenwerte auslesen" Click="KundenwerteAuslesen"/>

EDIT: App reaches Breakpoint at the end of the Contructor, at the end of NavigationHelper_LoadState and at the end of OnNavigatedTo

EDIT: i've changed the target-view to navigate to, but the pronlem still persists, so i assume, that the Problem occurs in the current view

Romasz
  • 29,662
  • 13
  • 79
  • 154
mech
  • 617
  • 6
  • 16
  • [Try to debug Suspending events](http://stackoverflow.com/a/24103734/2681948). – Romasz Mar 14 '15 at 20:08
  • i don't know, why i should suspend the app ... "Suspending event won't fire while you are Debugging" - i'm only in debug-mode ... Maybe i told it incorrectly, the app crashes while navigating from one Page to another – mech Mar 14 '15 at 20:14
  • Are the lines of code commented out when you observe the crash? and what event is calling those methods? (i.e. a button click?) – erotavlas Mar 14 '15 at 20:42
  • i've edited the post, hope it helps helping me ;) – mech Mar 14 '15 at 20:51
  • opposite order? do you think of the order of the menuFlyoutItems? Edit: changed the order of the MenuFlyoutItems, but as expected no effect – mech Mar 14 '15 at 20:56
  • Can you try to obtain the exception? – erotavlas Mar 14 '15 at 21:09
  • i would if i could ... there is no exception ... at least no exception i can see ... no break, nothing, it is as if i would just Close the app normaly – mech Mar 14 '15 at 21:11
  • https://ertayshashko.wordpress.com/2014/05/27/how-to-access-unhandled-exceptions-in-windows-phone-8-1-winrt-app/ – erotavlas Mar 14 '15 at 21:20
  • i have included some code from here http://www.markermetro.com/2013/01/technical/handling-unhandled-exceptions-with-asyncawait-on-windows-8-and-windows-phone-8/ ans set brakepoints, but no breakpoint matches, Output says: Das Programm "[492] ....exe" wurde mit Code -1073741819 (0xc0000005) 'Access violation' beendet. – mech Mar 14 '15 at 21:51
  • If it crash while debugging, then it is in fact less chance that it's caused by suspension. Were you have this code: ` – Romasz Mar 15 '15 at 08:33
  • the button works perfectly, but when coming from the menuflyoutitem, the app crashes. I guess that this has something to do with the generated menuflyout, because the methods are the same, except for the arguments. even the new view gets initialized, May be it is something with unloading the old page? – mech Mar 15 '15 at 08:56
  • Hard to say, is it possible that you share a sample project? – Romasz Mar 15 '15 at 14:53

0 Answers0