1

我正在尝试为在 Visual Studio 2008 中编写的 C# WinForms 应用程序跟踪运行 Windows 7 64 位的目标计算机上发生的错误。我所要做的就是从事件查看器输出 Windows 错误报告。我在这里找到了很多有用的信息:http: //www.codeilove.com/2012/09/debugging-using-windows-error-reporting.html

Problem signature:
P1: myprogram.exe // filename of the executable
P2: 1.44.0.0 // assembly version for the executable in P1
P3: 560be2df // assembly timestamp for the executable in P1
P4: mscorlib // assembly where the fault occurred
P5: 2.0.0.0 // assembly version for the assembly in P4
P6: 4ca2b889 // assembly timestamp for the assembly in P4
P7: c43 // token for the method where the fault occurred
P8: 59 // IL offset into the method specified in P7
P9: System.FormatException //  name of the exception that caused the fault

从链接看来,P7、P8 和 P9 是最重要的,我应该能够通过查找 06000c43 使用 ILDASM 找到“c43”的方法 def。在 C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll 中,我在 System.Number 中找到以下内容:

.method /*06000C43*/ assembly hidebysig static 
    uint64  ParseUInt64(string 'value',
                        valuetype System.Globalization.NumberStyles/*020003B6*/ options,
                        class System.Globalization.NumberFormatInfo/*020003B5*/ numfmt) cil managed

基于此信息,System.Number.ParseUInt64 中发生了 System.FormatException,对吗?我在 Visual Studio 中搜索了我的项目,但找不到我的代码调用此函数的任何实例。我从这里去哪里?

我有一个 Application.ThreadException 的顶级异常处理程序,它将未处理的异常记录到文件中。在这种情况下,我遇到了应用程序崩溃,并且我的日志文件中没有任何内容。假设此异常发生在我的 UI 以外的线程中是否安全?

4

1 回答 1

0

从 Vista SP1 开始,您可以配置 Windows 错误报告以收集本地故障转储。只需按照该文章中的说明在目标机器上设置注册表设置,然后等到您的程序再次崩溃。之后,检查您已配置为 DumpFolder 的目录。您应该在其中找到一个 .dmp 文件。在 WinDbg 或 Visual Studio 中打开它,您应该能够看到异常发生位置的完整堆栈跟踪。

于 2015-11-10T02:50:39.630 回答