Fix createdump fault in diagnostic tests (#46554)
authorMike McLaughlin <mikem@microsoft.com>
Tue, 5 Jan 2021 03:09:49 +0000 (19:09 -0800)
committerGitHub <noreply@github.com>
Tue, 5 Jan 2021 03:09:49 +0000 (19:09 -0800)
src/coreclr/debug/daccess/enummem.cpp

index d885ad3..5024153 100644 (file)
@@ -542,9 +542,12 @@ HRESULT ClrDataAccess::DumpManagedExcepObject(CLRDataEnumMemoryFlags flags, OBJE
             PCODE addr = pMD->GetNativeCode();
             if (addr != NULL)
             {
-                IJitManager::MethodRegionInfo methodRegionInfo = { NULL, 0, NULL, 0 };
                 EECodeInfo codeInfo(addr);
-                codeInfo.GetMethodRegionInfo(&methodRegionInfo);
+                if (codeInfo.IsValid())
+                {
+                    IJitManager::MethodRegionInfo methodRegionInfo = { NULL, 0, NULL, 0 };
+                    codeInfo.GetMethodRegionInfo(&methodRegionInfo);
+                }
             }
         }