替换TryGetDacLocation()

时间:2017-10-02 09:18:50

标签: clrmd

开,GitHub for ClrMd,我读了

// If we just happen to have the correct dac file installed on the machine,
// the "TryGetDacLocation" function will return its location on disk:
string dacLocation = version.TryGetDacLocation();

我已经通过NuGet添加了ClrMd。在属性中,它显示Microsoft.Diagnostics.Runtime版本0.8.31.1,并且该方法在ClrVersion对象上不可用。

class Program
{
    static void Main(string[] args)
    {
        var dump = DataTarget.LoadCrashDump(args[0]);
        dump.SymbolLocator.SymbolPath = @"srv*d:\debug\symbols\*https://msdl.microsoft.com/download/symbols";
        // TODO: Hack. We assume that there's at least one runtime.
        ClrInfo clrVersion = dump.ClrVersions[0];
    }
}

我看到this question表示该方法已被删除 - 但我该怎么办呢?

1 个答案:

答案 0 :(得分:0)

ClrInfo实例的LocalMatchingDac属性将为您提供DAC位置。

class Program
{
    static void Main(string[] args)
    {
        var dump = DataTarget.LoadCrashDump(args[0]);
        dump.SymbolLocator.SymbolPath = @"srv*d:\debug\symbols\*https://msdl.microsoft.com/download/symbols";
        // TODO: Hack. We assume that there's at least one runtime.
        ClrInfo clrVersion = dump.ClrVersions[0];
        // Get the DAC location
        string dacLocation = clrVersion.LocalMatchingDac;
    }
}

HTH

道格