From: Steve MacLean Date: Wed, 18 Mar 2020 19:01:38 +0000 (-0400) Subject: [dotnet-dump] Allow Linux core dumps to be loaded on WIndows (#927) X-Git-Tag: submit/tizen_5.5/20200504.045052~11^2^2~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=877e11bd7fc1f536710621c4dfd92d8dfd6c206c;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git [dotnet-dump] Allow Linux core dumps to be loaded on WIndows (#927) * [dotnet-dump] Allow Linux core dumps to be loaded on WIndows * Respond to feedback --- diff --git a/src/Tools/dotnet-dump/Analyzer.cs b/src/Tools/dotnet-dump/Analyzer.cs index 339901db5..500cfb965 100644 --- a/src/Tools/dotnet-dump/Analyzer.cs +++ b/src/Tools/dotnet-dump/Analyzer.cs @@ -56,7 +56,19 @@ namespace Microsoft.Diagnostics.Tools.Dump target = DataTarget.LoadCoreDump(dump_path.FullName); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - target = DataTarget.LoadCrashDump(dump_path.FullName, CrashDumpReader.ClrMD); + try + { + target = DataTarget.LoadCoreDump(dump_path.FullName); + } + catch (InvalidDataException) + { + // This condition occurs when we try to load a Windows dump as a Elf core dump. + } + + if (target == null) + { + target = DataTarget.LoadCrashDump(dump_path.FullName, CrashDumpReader.ClrMD); + } } else { throw new PlatformNotSupportedException($"Unsupported operating system: {RuntimeInformation.OSDescription}");