Unhandled Exception with no description or debug info.

I decided to give Xamarin.Forms a go and see how it was going. I tried doing a simple Items page.

This is the code: http://pastebin.com/mSRXiET5

The error I get is attached.

How am I supposed to troubleshoot issues without proper guidance?

Any idea what is causing this?

Posts

  • AdamPAdamP AUUniversity ✭✭✭✭✭

    @BrunoKlein - personally I like creating a windows phone app as well to debug all the forms development in. The debug errors you get back from WP are far clearer and tell you where the issue is. iOS and Android in particular give you vague non-descriptive error messages that are a nightmare to track down.

  • JohnHardmanJohnHardman GBUniversity mod

    @BrunoKlein - when an unhandled exception is caught and reported in Visual Studio, it "breaks" in this piece of code:

            UnhandledException += (sender, e) =>
            {
                if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
            };
    

    Use Visual Studio to look at the local variable 'e'. This contains details of the exception. Normally you will need to expand it out in the locals window to get the detail.

  • ThomasBurkhartThomasBurkhart DEMember ✭✭✭✭

    @JohnHardman Where is this code piece located?
    Also a good way is to use Xamarin-Insight. There you get the exception and a Stacktrace.

  • JohnHardmanJohnHardman GBUniversity mod
    edited February 2016

    @ThomasBurkhart - On Windows, the code above appears in the generated file App.g.i.cs

    In code of my own, I have the following:

    On WinPhone 8.1 and Windows, in App.xaml.cs, in OnLaunched:

            UnhandledException += (sender, eo) =>
            {
                try
                {
                    Exception ex = eo.Exception as Exception;
                    if (ex != null)
                        InsightsWrapper.ReportException(ex);
                }
                catch (Exception ex)
                {
                    InsightsWrapper.ReportException(ex);
                }
            };
    

    On Android, in MainActivity.cs, in OnCreate:

            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
            {
                try
                {
                    Exception ex = e.ExceptionObject as Exception;
                    if (ex != null)
                        InsightsWrapper.ReportException(ex);
                }
                catch (Exception ex)
                {
                    InsightsWrapper.ReportException(ex);
                }
            };
    

    On iOS, in Main.cs, in Main:

            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
            {
                try
                {
                    Exception ex = e.ExceptionObject as Exception;
                    if (ex != null)
                        InsightsWrapper.ReportException(ex);
                }
                catch (Exception ex)
                {
                    InsightsWrapper.ReportException(ex);
                }
            };
    
  • Liêm_NguyễnLiêm_Nguyễn USMember ✭✭✭✭

    @JohnHardman said:
    @BrunoKlein - when an unhandled exception is caught and reported in Visual Studio, it "breaks" in this piece of code:

            UnhandledException += (sender, e) =>
            {
                if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
            };
    

    Use Visual Studio to look at the local variable 'e'. This contains details of the exception. Normally you will need to expand it out in the locals window to get the detail.

    Thank you!

Sign In or Register to comment.