首先我在 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 扩展并在 windbg 中分析您的转储而不是 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/