private void DiffImportSections() { Dictionary <string, ReadyToRunImportSection.ImportSectionEntry> leftImports = GetImports(_leftDumper.Reader); Dictionary <string, ReadyToRunImportSection.ImportSectionEntry> rightImports = GetImports(_rightDumper.Reader); HashSet <string> commonKeys = new HashSet <string>(leftImports.Keys); commonKeys.IntersectWith(rightImports.Keys); _writer.WriteLine("Import entries"); _writer.WriteLine("--------------"); foreach (string key in commonKeys.OrderBy(k => k)) { ReadyToRunImportSection.ImportSectionEntry leftEntry = leftImports[key]; ReadyToRunImportSection.ImportSectionEntry rightEntry = rightImports[key]; StringWriter leftInfo = new StringWriter(); StringWriter rightInfo = new StringWriter(); leftEntry.GCRefMap?.WriteTo(leftInfo); rightEntry.GCRefMap?.WriteTo(rightInfo); string leftGCRefMap = leftInfo.ToString(); string rightGCRefMap = rightInfo.ToString(); if (leftGCRefMap != rightGCRefMap) { _writer.WriteLine($@"Method: {key}"); _writer.WriteLine($@"Left GC ref map: {leftGCRefMap}"); _writer.WriteLine($@"Right GC ref map: {rightGCRefMap}"); } } _writer.WriteLine(); }
public static void WriteTo(this ReadyToRunImportSection.ImportSectionEntry theThis, TextWriter writer, DumpOptions options) { if (!options.Naked) { writer.Write($"+{theThis.StartOffset:X4}"); writer.Write($" ({theThis.StartRVA:X4})"); writer.Write($" Section: 0x{theThis.Section:X8}"); writer.Write($" SignatureRVA: 0x{theThis.SignatureRVA:X8}"); writer.Write(" "); } writer.Write(theThis.Signature); if (theThis.GCRefMap != null) { writer.Write(" -- "); theThis.GCRefMap.WriteTo(writer); } }