Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can cause a WP7 app to crash with no exception

I have an app that works ok on the device emulator but on the real device it crashes after some time. It can happen after some minutes as well after 1-2 hours. The problem happens both with the device alone or attached to visual studio.

The point is that no exception is being thrown, VS just reports the connection was lost. I did check if i'm using too much memory but that's not the case (http://stackoverflow.com/questions/4239193/whats-causing-my-wp7-app-to-crash).

What can cause apps to crash without throwing exceptions?

like image 398
Zmaster Avatar asked May 23 '11 17:05

Zmaster


2 Answers

It can crash without a visible exception on a Stackoverflow.

While debugging, you can detect such an exception by adding an event handler to Application.UnhandledException and writing the exception details in the Debug.WriteLine method. The result is visible in the Visual Studio Output / Debug window.

    private void OnAppUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
    {
        Debug.WriteLine(e.ExceptionObject.ToString());
    }
like image 105
thumbmunkeys Avatar answered Nov 03 '22 00:11

thumbmunkeys


You could get a crash that isn't caught if it happens on a non-UI thread. Check your async calls.

Also, any error in code that is executed in response to an action on an application bar button item or menu item could have cause this behaviour.

like image 36
Matt Lacey Avatar answered Nov 03 '22 00:11

Matt Lacey