Fix dotnet-dump analyze clrmd CreateRuntime (#940)
authorSteve MacLean <Steve.MacLean@microsoft.com>
Tue, 24 Mar 2020 01:40:50 +0000 (21:40 -0400)
committerGitHub <noreply@github.com>
Tue, 24 Mar 2020 01:40:50 +0000 (21:40 -0400)
src/Tools/dotnet-dump/Analyzer.cs

index d630392ad4bd59388adca4c3d929de9853d96069..ead2bad85dfeb509fbffaffeb924533378668aeb 100644 (file)
@@ -201,7 +201,7 @@ namespace Microsoft.Diagnostics.Tools.Dump
                 // Ignore the DAC version mismatch that can happen on Linux because the clrmd ELF dump 
                 // reader returns 0.0.0.0 for the runtime module that the DAC is matched against. This
                 // will be fixed in clrmd 2.0 but not 1.1.
-                runtime = clrInfo.CreateRuntime(dacFilePath, ignoreMismatch: RuntimeInformation.IsOSPlatform(OSPlatform.Linux));
+                runtime = clrInfo.CreateRuntime(dacFilePath, ignoreMismatch: clrInfo.ModuleInfo.BuildId != null);
             }
             catch (DllNotFoundException ex)
             {
@@ -241,6 +241,14 @@ namespace Microsoft.Diagnostics.Tools.Dump
                                 KeyTypeFlags.ClrKeys, clrInfo.ModuleInfo.FileName, clrInfo.ModuleInfo.BuildId, symbolFile: false, symbolFileName: null);
 
                             key = keys.SingleOrDefault((k) => Path.GetFileName(k.FullPathName) == dacFileName);
+
+                            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+                            {
+                                // We are opening a Linux dump on Windows
+                                // We need to use the Windows index and filename
+                                key = new SymbolStoreKey(key.Index.Replace("libmscordaccore.so", "mscordaccore.dll"),
+                                                         key.FullPathName.Replace("libmscordaccore.so", "mscordaccore.dll"));
+                            }
                         }
                         else
                         {