From 3c99b4b11744158c1660d17b193c6f3f271de770 Mon Sep 17 00:00:00 2001 From: Steve MacLean Date: Thu, 19 Mar 2020 17:10:36 -0400 Subject: [PATCH] Fix LoadNativeSymbols for cross-dac (#929) --- src/SOS/SOS.NETCore/SymbolReader.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/SOS/SOS.NETCore/SymbolReader.cs b/src/SOS/SOS.NETCore/SymbolReader.cs index 2cd025443e..1ee6180939 100644 --- a/src/SOS/SOS.NETCore/SymbolReader.cs +++ b/src/SOS/SOS.NETCore/SymbolReader.cs @@ -282,7 +282,16 @@ public static void LoadNativeSymbols(SymbolFileCallback callback, IntPtr paramet else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { var peFile = new PEFile(new StreamAddressSpace(stream), true); - generator = new PEFileKeyGenerator(s_tracer, peFile, moduleFilePath); + if (peFile.IsValid()) + { + generator = new PEFileKeyGenerator(s_tracer, peFile, moduleFilePath); + } + else + { + // Support loading ELF files on Windows for the cross-dac + var elfFile = new ELFFile(new StreamAddressSpace(stream), 0, true); + generator = new ELFFileKeyGenerator(s_tracer, elfFile, moduleFilePath); + } } else { return;