0
votes

I got a Windows Phone 8 app, that I've been developing over 2 years, its about 15k lines of code now. Starting from today it suddenly keeps crashing after showing the main screen for 5 secs. I've debugged it from the very first line of code and all the way through, to where the main screen is done running code.

I get no exceptions and I can't see anything wrong by the looks of it. Is there something else I can do to locate where/when/why it crashes?

EDIT: After a closer look i found this in my output:

An exception of type 'System.Net.WebException' occurred in System.Windows.ni.dll and wasn't handled before a managed/native boundary An exception of type 'System.Net.WebException' occurred in System.Windows.ni.dll and wasn't handled before a managed/native boundary 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\en-US\System.Xml.debug.resources.DLL'. Module was built without symbols. An exception of type 'System.Xml.XmlException' occurred in System.Xml.ni.dll and wasn't handled before a managed/native boundary 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs{6932AD96-A8AA-45F2-BC4E-81B7665641D8}\Install\microsoft.phone.controls.DLL'. Cannot find or open the PDB file. 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\LocationService.Interop.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. An exception of type 'System.OutOfMemoryException' occurred in System.Windows.ni.dll and wasn't handled before a managed/native boundary 'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\en-US\mscorlib.debug.resources.dll'. Module was built without symbols. An exception of type 'System.Runtime.InteropServices.SEHException' occurred in Unknown Module. and wasn't handled before a managed/native boundary The program '[2540] TaskHost.exe' has exited with code 0 (0x0).

But I don't know what to make of it.

1

1 Answers

0
votes

You can try handling the Application.UnhandledException event. This event is raised whenever an exception is unhandled by the Windows Phone application.

There may be certain very rare scenarios where this is not triggered though, like in the event of an OutOfMemoryException.

In your project, you should have a class that extends Application. Modify its constructor to subscribe to this event

public partial class App : Application
{
    public App()
    {
        ...
        this.UnhandledException += this.Application_UnhandledException;
        InitializeComponent();
    }

    private void Application_UnhandledException(object sender, 
        ApplicationUnhandledExceptionEventArgs e)
    {
        Debug.WriteLine(e.ExceptionObject);
    }
}