From 46b3f6c0ea291a3c168115e82d37b92ee078a022 Mon Sep 17 00:00:00 2001 From: jfrijters Date: Thu, 13 Jan 2011 15:27:03 +0000 Subject: [PATCH] Prevent invalid operations on MissingModule. --- reflect/Missing.cs | 40 ++++++++++++++++++++++++++++++++++++++++ reflect/Module.cs | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/reflect/Missing.cs b/reflect/Missing.cs index 10d367d9..04d72c94 100644 --- a/reflect/Missing.cs +++ b/reflect/Missing.cs @@ -296,6 +296,46 @@ namespace IKVM.Reflection { throw new MissingModuleException(this); } + + public override void __GetDataDirectoryEntry(int index, out int rva, out int length) + { + throw new MissingModuleException(this); + } + + public override IList __GetPlaceholderAssemblyCustomAttributes(bool multiple, bool security) + { + throw new MissingModuleException(this); + } + + public override long __RelativeVirtualAddressToFileOffset(int rva) + { + throw new MissingModuleException(this); + } + + public override __StandAloneMethodSig __ResolveStandAloneMethodSig(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) + { + throw new MissingModuleException(this); + } + + public override int __Subsystem + { + get { throw new MissingModuleException(this); } + } + + internal override void ExportTypes(int fileToken, IKVM.Reflection.Emit.ModuleBuilder manifestModule) + { + throw new MissingModuleException(this); + } + + public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine) + { + throw new MissingModuleException(this); + } + + internal override IList GetCustomAttributesData(Type attributeType) + { + throw new MissingModuleException(this); + } } sealed class MissingType : Type diff --git a/reflect/Module.cs b/reflect/Module.cs index a481ae23..84998dad 100644 --- a/reflect/Module.cs +++ b/reflect/Module.cs @@ -402,7 +402,7 @@ namespace IKVM.Reflection internal abstract ByteReader GetBlob(int blobIndex); - internal IList GetCustomAttributesData(Type attributeType) + internal virtual IList GetCustomAttributesData(Type attributeType) { return GetCustomAttributes(0x00000001, attributeType); }