diff --git a/ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs b/ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs index 6c4aa4acd..459a71a14 100644 --- a/ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs +++ b/ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs @@ -302,7 +302,15 @@ namespace ICSharpCode.Decompiler.CSharp case OperandType.Sig: case OperandType.Tok: case OperandType.Type: - var handle = MetadataTokenHelpers.EntityHandleOrNil(instructions.ReadInt32()); + EntityHandle handle; + try + { + handle = MetadataTokenHelpers.EntityHandleOrNil(instructions.ReadInt32()); + } + catch (BadImageFormatException) + { + return; + } if (handle.IsNil) break; switch (handle.Kind)