Gathering and analyzing App Center crash reports
The last topic we will cover in this chapter is monitoring application crashes with App Center. Because we added Crashes
to the call to AppCenter.Start
in App.xaml.cs, any crashes will automatically be reported to App Center's analytics. But how can we simulate a crash while we're developing an application?
To simulate a crash, add the following line of code to any application sometime after the AppCenter.Start
call has been completed. Let's add it to the beginning of the SelectedMediaItem
property setter in MainViewModel
. Clicking on any media item in the collection will generate a crash for us. Use the #if DEBUG
preprocessor directive to ensure that this will not happen in your application in production:
#if DEBUG Â Â Â Â Crashes.GenerateTestCrash(); #endif
Don't forget to add a using
statement to the class as well:
using Microsoft.AppCenter.Crashes;
Note
GenerateTestCrash
will...