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

Inspect dump files from UWP app

首先,我在 Windows 10 Mobile phone:

上启用了转储文件保存

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

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

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

大约有 140 MB!

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


如果我 运行 仅使用托管进行调试 我得到

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

点击中断我得到

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).

观看1window我看到了下面的

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.

所以我只能阻止


如果我运行用混合调试我又得到了

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

点击中断我得到

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。它应该存在吗?我应该在哪里找到它?

看1window看到和上面一样,只能停


如果我 运行 仅使用本机调试 我得到

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 我得到了与上面相同的缺少内核库错误,但是在 Watch 1 window Unable to evaluate the expression。所以我只能阻止了。


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

你提到

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

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

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

要分析此类异常,请先观看Channel 9 Defrag Tools, episode 136 where Andrew Richards explains and then analyzes them (at 3:28)。 然后从 Defrag Tools OnDrive and analyze your dump in 而不是 Visual Studio 下载 PDE 扩展。

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

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