在 Windows Phone 8.1 上捕获转储 [英] capturing dump on Windows Phone 8.1

查看:31
本文介绍了在 Windows Phone 8.1 上捕获转储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Windows Phone 8.1 应用.我想添加一个功能,每当应用程序崩溃时,都会捕获内存转储并将其写入日志.

I am developing a Windows Phone 8.1 app. I want to add a functionality that whenever the app crashes a memory dump is captured and written to a log.

我想知道当用户在他的手机上使用应用程序时是否有任何方法可以记录崩溃转储并且它崩溃了.我发现这个问题与我的相似,但适用于 Windows 8.它说我们可以使用 App.xaml.cs 中的 'Application_UnhandledException' 方法来获取转储.但是Windows Phone 8.1 是否也支持这种方法 因为我在 App.xaml.cs(由 Visual Studio 生成并包含 OnActivated、OnLaunched 等函数)的自动生成内容中没有看到这一点等)

I want to know if there is any way to log the crash dump while the user is using the app on his phone and it crashes. I found this question which is similar to mine but is for Windows 8. It says that we can use the 'Application_UnhandledException' method in App.xaml.cs to obtain the dump. But is this method supported in Windows Phone 8.1 too because I didn't see this in the auto-generated content of App.xaml.cs(which is generated by Visual Studio and contains functions like OnActivated, OnLaunched etc.)

UnhandledException 事件处理程序是否在 Windows Phone 8.1 中执行此操作?

Does the UnhandledException event handler do this thing in Windows Phone 8.1?

推荐答案

Silverlight 8.1 App.xaml.cs 类有一个 UnhandledException 事件处理程序,就像 8.0 一样.

The Silverlight 8.1 App.xaml.cs class has an UnhandledException event handler just like 8.0.

另一方面,WinRT 8.1 应用要求您自己添加处理程序.

WinRT 8.1 apps on the other hand require you to add the handler yourself.

为此,请转到 App.xaml.cs 并在构造函数中添加以下内容:

To do this, go to App.xaml.cs and in the constructor, add the following:

this.UnhandledException += App_UnhandledException;

还要添加此事件处理程序:

Also add this event handler:

private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
    {
        // Save the dump here.
    }

这篇关于在 Windows Phone 8.1 上捕获转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆