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 pr开发者_JAVA百科oblem 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?
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());
}
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.
It could be that the phsycal device does not exactly match the emulation configuration. You may be sending an error to a output stream that does not exist on the device, or sending it to something that is local for the emulator and remote for the device.
Also, you may just be satisfying different conditions that bring you to a clean exit.
The emulator is probably running clean compared to all the background applications on many devices.
Logging and debuging are your friends.
Your question is interesting but lacks detail.
I have had a few instances of invalid xaml crashing the app.
You can change the settings in visual studio for exceptions to break on all exceptions to track down what is happening.
精彩评论