【问题标题】:Microsoft.Diagnostics.Runtime: how to read crash dump?Microsoft.Diagnostics.Runtime:如何读取故障转储?
【发布时间】:2013-06-24 18:46:06
【问题描述】:

我使用Microsoft.Diagnostics.Runtime 并尝试分析故障转储,但我的机器上没有匹配的 mscordacwks.dll

请给我一个建议,或者我如何从 Microsoft 的符号服务器获取它?

【问题讨论】:

标签: c# windows-runtime


【解决方案1】:

缺少 mscordacwks.dll 是我不时使用 WinDbg 查看故障转储文件时遇到的一种痛苦(我注意到您正在尝试使用 ClrMD 来实现相同的最终目标)。通常,microsoft 符号服务器非常全面,但对于 mscordacwks.dll,并非所有版本都存在于公共符号服务器上(如here 所述)。获取匹配的 mscordacwks.dll 版本的最佳方法是在公共符号服务器出现故障时从创建故障转储的机器(以及相应的 .net 框架文件夹)中提取它。

老实说,我更像是一个 WinDbg 用户,所以我更习惯在那里与 mscordacwks 打交道,但是通过谷歌搜索,我确实找到了一些有趣的文章。第一个提到你可以这样做:

// DataTarget.ClrVersions lists the versions of CLR loaded in the process (this may be
// v2 and v4 in the Side-By-Side case.
ClrInfo version = target.ClrVersions[0];

// CLRVersionInfo contains information on the correct Dac dll to load.  This includes
// the long named dac, the version of clr, etc.  This is enough information to request
// the dac from the symbol server (though we do not provide an API to do this).  Also,
// if the version you are debugging is actually installed on your machine, DacLocation
// will contain the full path to the dac.
string dacLocation = version.TryGetDacLocation();

如果这不起作用,那么有人发布了更复杂的 DacLocator 类的代码。希望这两种途径之一应该适用于加载您需要的 dll 版本。

【讨论】:

    【解决方案2】:

    现在 ClrVersion 类上有一个 TryDownloadDac 方法。您需要在与您正在调试的应用程序(64 位/32 位)相同的架构中运行您的进程,以便成功地将 DAC 库加载到您的进程中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-09
      • 2016-03-21
      • 2014-03-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-10
      • 1970-01-01
      相关资源
      最近更新 更多