I'm developing a Windows Phone App. I submitted it to Microsoft and they sent me back a file describing an error that occurs when resuming the app (it's relative to the 5.2 Performance and Resource Management, point 5.2.3).
To reproduce the error, I run the app, I start on the start button to go to the "desktop" and click on the "Back" button.
After that, the visual studio highlights in yellow the System.Diagnostics.Debugger.Break();
line in this code
// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
}
With the stacktrace, I found that the last called method was CallApplicationUEHandler
.
So, is it a known exception? Did I forget to handle some exceptions?
Here are the last three lines of output just above the the call of CallApplicationUEHandler:
first chance exception 'System.ArgumentNullException' in Microsoft.Phone.Controls.dll
first chance exception 'System.ArgumentException' in System.Windows.dll
first chance exception 'System.ArgumentException' in System.Windows.dll
The constructors:
For the MainPage:
public MainPage()
{
journal.Debug(string.Format("Entrée méthode {0}", new StackTrace().GetFrame(1).GetMethod().Name));
InitializeComponent();
Loaded += new RoutedEventHandler(PhoneApplicationPage_Loaded);
}
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
mainVM = new MainViewModel();
DataContext = mainVM;
}
For the App:
public App()
{
// Global handler for uncaught exceptions.
// Note that exceptions thrown by ApplicationBarItem.Click will not get caught here.
UnhandledException += Application_UnhandledException;
// Standard Silverlight initialization
InitializeComponent();
// Phone- {2} -specific initialization
InitializePhoneApplication();
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
}