Replacement of TryGetDacLocation()

161 views Asked by At

On, GitHub for ClrMd, I read

// 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();

I have added ClrMd via NuGet. In the properties it says Microsoft.Diagnostics.Runtime version 0.8.31.1 and that method is not available on the ClrVersion object.

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];
    }
}

I have seen this question which states that the method was removed - but what do I do instead?

1

There are 1 answers

1
Doug Stewart - MSFT On

The LocalMatchingDac property of the ClrInfo instance will give you the DAC location.

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

Doug