Browse Source

Fix #3273: Do not crash, if an unsupported metadata table is found.

pull/3276/head
Siegfried Pammer 9 months ago
parent
commit
673943cf14
  1. 14
      ILSpy/Metadata/MetadataTableTreeNode.cs
  2. 2
      ILSpy/Metadata/MetadataTablesTreeNode.cs

14
ILSpy/Metadata/MetadataTableTreeNode.cs

@ -145,4 +145,18 @@ namespace ICSharpCode.ILSpy.Metadata @@ -145,4 +145,18 @@ namespace ICSharpCode.ILSpy.Metadata
{
}
}
internal class UnsupportedMetadataTableTreeNode : MetadataTableTreeNode
{
public UnsupportedMetadataTableTreeNode(TableIndex kind, MetadataFile file)
: base(kind, file)
{
}
public override object Text => $"{(int)Kind:X2} {Kind.ToString()} [unsupported] ({metadataFile.Metadata.GetTableRowCount(Kind)})";
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
{
output.WriteLine($"Unsupported table '{(int)Kind:X2} {Kind}' contains {metadataFile.Metadata.GetTableRowCount(Kind)} rows.");
}
}
}

2
ILSpy/Metadata/MetadataTablesTreeNode.cs

@ -142,7 +142,7 @@ namespace ICSharpCode.ILSpy.Metadata @@ -142,7 +142,7 @@ namespace ICSharpCode.ILSpy.Metadata
case TableIndex.CustomDebugInformation:
return new CustomDebugInformationTableTreeNode(metadataFile);
default:
throw new ArgumentException($"Unsupported table index: {table}");
return new UnsupportedMetadataTableTreeNode(table, metadataFile);
}
}

Loading…
Cancel
Save