Avi*_*mar 3 c# crash-dumps windows-phone-8
我正在开发一个Windows Phone 8.1应用程序.我想添加一个功能,只要应用程序崩溃,就会捕获内存转储并将其写入日志.
我想知道当用户在手机上使用该应用程序并且崩溃时,是否有任何方法可以记录崩溃转储.我发现这个问题与我的相似,但适用于Windows 8.它说我们可以在App.xaml.cs中使用'Application_UnhandledException'方法来获取转储.但这种方法是否也支持在Windows Phone 8.1中,因为我没有在App.xaml.cs的自动生成内容中看到这一点(由Visual Studio生成并包含OnActivated,OnLaunched等功能)
UnhandledException事件处理程序是否在Windows Phone 8.1中执行此操作?
Silverlight 8.1 App.xaml.cs类有一个像8.0一样的UnhandledException事件处理程序.
另一方面,WinRT 8.1应用程序要求您自己添加处理程序.
为此,请转到App.xaml.cs并在构造函数中添加以下内容:
this.UnhandledException += App_UnhandledException;
Run Code Online (Sandbox Code Playgroud)
还要添加此事件处理程序:
private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
// Save the dump here.
}
Run Code Online (Sandbox Code Playgroud)