c# - 检查来自 UWP 应用的转储文件

标签 c# debugging win-universal-app windows-10-mobile crash-dumps

首先我在 Windows 10 手机上启用了保存转储文件:

Settings > Update & Security > For developers > Save this many crash dumps: 3

然后我调试了一个抛出异常的应用程序。我停止后继续调试。断开并再次连接手机后,我能够访问存储在 Windows phone\Phone\Documents\Debug 目录下的转储文件。该文件名为

FPCL.WIndows - a736c773-c105-4b30-a799-4bf317872f5e 异常 C000027B on 5-03-2016 12.11.dmp

大约有 140 MB!

我将该文件复制到我的 UWP 应用的 bin 目录中。之后,我在 Visual Studio 2015(在同一项目中)中将其作为文件打开。现在我可以看到 Dump Summary 并且我有以下按钮:

  • 仅使用托管进行调试
  • 混合调试
  • 仅使用 native 进行调试
  • 设置符号路径
  • 全部复制到剪贴板

如果我运行 Debug with Managed Only 我会得到

A fatal exception was caught by the runtime. See $stowedexception in the Watch window to view the original exception information.

点击Break我得到

No compatible code running. The selected debug engine does not support any code executing on the current thread (e.g. only native runtime code is executing).

Watch 1 窗口中,我看到以下内容

Name: {CLR}$stowedexception
Value: {"The method or operation is not implemented."}
Type: System.NotImplementedException

这应该是我在我的应用程序中抛出的异常。当我打开此节点并在 StackTrace 下查看时,我可以获得一个行号。按继续我得到

The debugger cannot continue running the process. This operation is not supported when debugging dump files.

所以我只能阻止了。


如果我运行 Debug with Mixed 我又得到了

A fatal exception was caught by the runtime. See $stowedexception in the Watch window to view the original exception information.

点击Break我得到

kernelbase.pdb not loaded kernelbase.pdb contains the debug information required to find the source for the module KERNELBASE.dll Module Information: Version: 10.0.10586.218 (th2_release.160401-1800) Original Location: KERNELBASE.dll Try one of the following options: Change existing PDB and binary search paths and retry: Microsoft Symbol Servers

在这里,我可以按加载新建。因此在给定位置下找不到 kernelbase.pdb。它应该存在吗?我应该在哪里找到它?

Watch 1 窗口中,我看到与上面相同的内容,我只能停止它。


如果我运行 Debug with Native Only 我得到

Unhandled exception at 0x76ECDF95 (combase.dll) in FPCL.WIndows - f736c883-f105-4d30-a719-4bf328872f5e with exception C000027B on 5-03-2016 12.11.dmp: 0xC000027B: Anwendungsinterne Ausnahme (parameters: 0x075C6838, 0x00000002).

在单击Break 时,我得到了与上面相同的 missing kernelbase 错误,但是在 Watch 1 窗口中,Value无法计算表达式。所以我只能阻止了。


根据这个post我应该能够检查源代码并找到原因。但是如何正确检查这样的 UWP 转储文件?

最佳答案

你提到

[...] 0xC000027B [...]

[...] $stowedexception [...]

这两个指标都表明转储中存在 Stowed Exception。

要分析此类异常,请先观看 Channel 9 Defrag Tools, episode 136 Andrew Richards 在其中解释并分析了它们(位于 3:28)。 然后从 Defrag Tools OnDrive 下载 PDE 扩展并在 中分析您的转储而不是 Visual Studio。

关于kernelbase的符号,应该从微软的符号服务器上下载。要在 WinDbg 中进行设置,请使用 .symfix;.reload。如果您想在 Visual Studio 中再试一次,请转到“调试”/“选项”并选择“调试”/“符号”,然后选中“Microsoft 符号服务器”。

关于在 Visual Studio 中按下的按钮,在调试调试版本时选择“Managed only”,因为您的应用程序将在 CoreCLR 上运行,而在调试发布版本时选择“Native Only”,因为您的应用程序将使用 .NET native运行时支持。 (如果您没有更改默认设置,则适用;否则根据您的编译设置选择)

关于c# - 检查来自 UWP 应用的转储文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37002752/

相关文章:

c# - 如何在 UWP 应用程序中列出我的文件夹

c# - ResetBindings() 不更新 BindingSource

debugging - 调试 R 代码时如何跳过循环

c++ - 调试断言失败: vector 下标超出范围

debugging - 检测VB6中是否附加调试器

c# - 如何安装 SQLite 以在面向 UAP v10 的通用 Windows 应用程序中使用

c# - 改变进度条的大小

c# - VS2010 代码分析期间的 IDisposable 和 CA2000 警告

c# - datagridview 在 Windows 窗体中显示空行

c# - 聚合事件网格事件