diff --git a/ICSharpCode.Decompiler/Disassembler/DisassemblerHelpers.cs b/ICSharpCode.Decompiler/Disassembler/DisassemblerHelpers.cs index 29e24ddba..6bc2e5e5e 100644 --- a/ICSharpCode.Decompiler/Disassembler/DisassemblerHelpers.cs +++ b/ICSharpCode.Decompiler/Disassembler/DisassemblerHelpers.cs @@ -72,7 +72,7 @@ namespace ICSharpCode.Decompiler.Disassembler writer.WriteLocalReference(OffsetToString(offset.Value), offset); } - public static void WriteTo(this SRM.ExceptionRegion exceptionHandler, Metadata.PEFile module, GenericContext context, ITextOutput writer) + public static void WriteTo(this SRM.ExceptionRegion exceptionHandler, Metadata.PEFile module, MetadataGenericContext context, ITextOutput writer) { writer.Write(".try "); WriteOffsetReference(writer, exceptionHandler.TryOffset); diff --git a/ICSharpCode.Decompiler/Disassembler/DisassemblerSignatureTypeProvider.cs b/ICSharpCode.Decompiler/Disassembler/DisassemblerSignatureTypeProvider.cs index b5bd2d0b0..5e0928450 100644 --- a/ICSharpCode.Decompiler/Disassembler/DisassemblerSignatureTypeProvider.cs +++ b/ICSharpCode.Decompiler/Disassembler/DisassemblerSignatureTypeProvider.cs @@ -25,7 +25,7 @@ using ICSharpCode.Decompiler.Metadata; namespace ICSharpCode.Decompiler.Disassembler { - public class DisassemblerSignatureTypeProvider : ISignatureTypeProvider, GenericContext> + public class DisassemblerSignatureTypeProvider : ISignatureTypeProvider, MetadataGenericContext> { readonly PEFile module; readonly MetadataReader metadata; @@ -107,7 +107,7 @@ namespace ICSharpCode.Decompiler.Disassembler }; } - public Action GetGenericMethodParameter(GenericContext genericContext, int index) + public Action GetGenericMethodParameter(MetadataGenericContext genericContext, int index) { return syntax => { output.Write("!!"); @@ -115,7 +115,7 @@ namespace ICSharpCode.Decompiler.Disassembler }; } - public Action GetGenericTypeParameter(GenericContext genericContext, int index) + public Action GetGenericTypeParameter(MetadataGenericContext genericContext, int index) { return syntax => { output.Write("!"); @@ -240,7 +240,7 @@ namespace ICSharpCode.Decompiler.Disassembler default: throw new BadImageFormatException($"Unexpected rawTypeKind: {rawTypeKind} (0x{rawTypeKind:x})"); } - ((EntityHandle)handle).WriteTo(module, output, GenericContext.Empty); + ((EntityHandle)handle).WriteTo(module, output, default); }; } @@ -260,11 +260,11 @@ namespace ICSharpCode.Decompiler.Disassembler default: throw new BadImageFormatException($"Unexpected rawTypeKind: {rawTypeKind} (0x{rawTypeKind:x})"); } - ((EntityHandle)handle).WriteTo(module, output, GenericContext.Empty); + ((EntityHandle)handle).WriteTo(module, output, default); }; } - public Action GetTypeFromSpecification(MetadataReader reader, GenericContext genericContext, TypeSpecificationHandle handle, byte rawTypeKind) + public Action GetTypeFromSpecification(MetadataReader reader, MetadataGenericContext genericContext, TypeSpecificationHandle handle, byte rawTypeKind) { return reader.GetTypeSpecification(handle).DecodeSignature(this, genericContext); } diff --git a/ICSharpCode.Decompiler/Disassembler/ILStructure.cs b/ICSharpCode.Decompiler/Disassembler/ILStructure.cs index 96900d561..77c79137a 100644 --- a/ICSharpCode.Decompiler/Disassembler/ILStructure.cs +++ b/ICSharpCode.Decompiler/Disassembler/ILStructure.cs @@ -60,7 +60,7 @@ namespace ICSharpCode.Decompiler.Disassembler { public readonly PEFile Module; public readonly MethodDefinitionHandle MethodHandle; - public readonly GenericContext GenericContext; + public readonly MetadataGenericContext GenericContext; public readonly ILStructureType Type; /// @@ -88,7 +88,7 @@ namespace ICSharpCode.Decompiler.Disassembler /// public readonly List Children = new List(); - public ILStructure(PEFile module, MethodDefinitionHandle handle, GenericContext genericContext, MethodBodyBlock body) + public ILStructure(PEFile module, MethodDefinitionHandle handle, MetadataGenericContext genericContext, MethodBodyBlock body) : this(module, handle, genericContext, ILStructureType.Root, 0, body.GetILReader().Length) { // Build the tree of exception structures: @@ -142,7 +142,7 @@ namespace ICSharpCode.Decompiler.Disassembler SortChildren(); } - public ILStructure(PEFile module, MethodDefinitionHandle handle, GenericContext genericContext, ILStructureType type, int startOffset, int endOffset, ExceptionRegion handler = default) + public ILStructure(PEFile module, MethodDefinitionHandle handle, MetadataGenericContext genericContext, ILStructureType type, int startOffset, int endOffset, ExceptionRegion handler = default) { Debug.Assert(startOffset < endOffset); this.Module = module; @@ -154,7 +154,7 @@ namespace ICSharpCode.Decompiler.Disassembler this.ExceptionHandler = handler; } - public ILStructure(PEFile module, MethodDefinitionHandle handle, GenericContext genericContext, ILStructureType type, int startOffset, int endOffset, int loopEntryPoint) + public ILStructure(PEFile module, MethodDefinitionHandle handle, MetadataGenericContext genericContext, ILStructureType type, int startOffset, int endOffset, int loopEntryPoint) { Debug.Assert(startOffset < endOffset); this.Module = module; diff --git a/ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs b/ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs index 3d085f25d..d297f77e3 100644 --- a/ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs +++ b/ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs @@ -74,7 +74,7 @@ namespace ICSharpCode.Decompiler.Disassembler // cache info PEFile module; MetadataReader metadata; - GenericContext genericContext; + MetadataGenericContext genericContext; DisassemblerSignatureTypeProvider signatureDecoder; public MethodBodyDisassembler(ITextOutput output, CancellationToken cancellationToken) @@ -87,7 +87,7 @@ namespace ICSharpCode.Decompiler.Disassembler { this.module = module ?? throw new ArgumentNullException(nameof(module)); metadata = module.Metadata; - genericContext = new GenericContext(handle, module); + genericContext = new MetadataGenericContext(handle, module); signatureDecoder = new DisassemblerSignatureTypeProvider(module, output); var methodDefinition = metadata.GetMethodDefinition(handle); @@ -198,7 +198,7 @@ namespace ICSharpCode.Decompiler.Disassembler { this.module = module; metadata = module.Metadata; - genericContext = new GenericContext(handle, module); + genericContext = new MetadataGenericContext(handle, module); signatureDecoder = new DisassemblerSignatureTypeProvider(module, output); var handlers = body.ExceptionRegions; if (!handlers.IsEmpty) diff --git a/ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs b/ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs index 67cd3ee9b..fed90b22a 100644 --- a/ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs +++ b/ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs @@ -143,7 +143,7 @@ namespace ICSharpCode.Decompiler.Disassembler public void DisassembleMethod(PEFile module, MethodDefinitionHandle handle) { - var genericContext = new GenericContext(handle, module); + var genericContext = new MetadataGenericContext(handle, module); // write method header output.WriteReference(module, handle, ".method", isDefinition: true); output.Write(" "); @@ -153,14 +153,14 @@ namespace ICSharpCode.Decompiler.Disassembler public void DisassembleMethodHeader(PEFile module, MethodDefinitionHandle handle) { - var genericContext = new GenericContext(handle, module); + var genericContext = new MetadataGenericContext(handle, module); // write method header output.WriteReference(module, handle, ".method", isDefinition: true); output.Write(" "); DisassembleMethodHeaderInternal(module, handle, genericContext); } - void DisassembleMethodHeaderInternal(PEFile module, MethodDefinitionHandle handle, GenericContext genericContext) + void DisassembleMethodHeaderInternal(PEFile module, MethodDefinitionHandle handle, MetadataGenericContext genericContext) { var metadata = module.Metadata; @@ -343,7 +343,7 @@ namespace ICSharpCode.Decompiler.Disassembler } void DisassembleMethodBlock(PEFile module, MethodDefinitionHandle handle, - GenericContext genericContext) + MetadataGenericContext genericContext) { var metadata = module.Metadata; var methodDefinition = metadata.GetMethodDefinition(handle); @@ -1132,7 +1132,7 @@ namespace ICSharpCode.Decompiler.Disassembler output.WriteLine(); } - void WriteGenericParameterAttributes(PEFile module, GenericContext context, GenericParameterHandle handle) + void WriteGenericParameterAttributes(PEFile module, MetadataGenericContext context, GenericParameterHandle handle) { var metadata = module.Metadata; var p = metadata.GetGenericParameter(handle); @@ -1324,7 +1324,7 @@ namespace ICSharpCode.Decompiler.Disassembler const FieldAttributes hasXAttributes = FieldAttributes.HasDefault | FieldAttributes.HasFieldMarshal | FieldAttributes.HasFieldRVA; WriteFlags(fieldDefinition.Attributes & ~(FieldAttributes.FieldAccessMask | hasXAttributes), fieldAttributes); - var signature = fieldDefinition.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), new GenericContext(fieldDefinition.GetDeclaringType(), module)); + var signature = fieldDefinition.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), new MetadataGenericContext(fieldDefinition.GetDeclaringType(), module)); var marshallingDescriptor = fieldDefinition.GetMarshallingDescriptor(); if (!marshallingDescriptor.IsNil) @@ -1411,7 +1411,7 @@ namespace ICSharpCode.Decompiler.Disassembler WriteFlags(propertyDefinition.Attributes, propertyAttributes); var accessors = propertyDefinition.GetAccessors(); var declaringType = metadata.GetMethodDefinition(accessors.GetAny()).GetDeclaringType(); - var signature = propertyDefinition.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), new GenericContext(declaringType, module)); + var signature = propertyDefinition.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), new MetadataGenericContext(declaringType, module)); if (signature.Header.IsInstance) output.Write("instance "); @@ -1441,7 +1441,7 @@ namespace ICSharpCode.Decompiler.Disassembler output.Write(keyword); output.Write(' '); - ((EntityHandle)method).WriteTo(module, output, GenericContext.Empty); + ((EntityHandle)method).WriteTo(module, output, default); output.WriteLine(); } #endregion @@ -1506,7 +1506,7 @@ namespace ICSharpCode.Decompiler.Disassembler signature = provider.GetTypeFromReference(module.Metadata, (TypeReferenceHandle)eventDefinition.Type, 0); break; case HandleKind.TypeSpecification: - signature = provider.GetTypeFromSpecification(module.Metadata, new GenericContext(declaringType, module), + signature = provider.GetTypeFromSpecification(module.Metadata, new MetadataGenericContext(declaringType, module), (TypeSpecificationHandle)eventDefinition.Type, 0); break; default: @@ -1556,7 +1556,7 @@ namespace ICSharpCode.Decompiler.Disassembler public void DisassembleType(PEFile module, TypeDefinitionHandle type) { var typeDefinition = module.Metadata.GetTypeDefinition(type); - GenericContext genericContext = new GenericContext(type, module); + MetadataGenericContext genericContext = new MetadataGenericContext(type, module); DisassembleTypeHeaderInternal(module, type, typeDefinition, genericContext); @@ -1663,11 +1663,11 @@ namespace ICSharpCode.Decompiler.Disassembler public void DisassembleTypeHeader(PEFile module, TypeDefinitionHandle type) { var typeDefinition = module.Metadata.GetTypeDefinition(type); - GenericContext genericContext = new GenericContext(type, module); + MetadataGenericContext genericContext = new MetadataGenericContext(type, module); DisassembleTypeHeaderInternal(module, type, typeDefinition, genericContext); } - private void DisassembleTypeHeaderInternal(PEFile module, TypeDefinitionHandle handle, TypeDefinition typeDefinition, GenericContext genericContext) + private void DisassembleTypeHeaderInternal(PEFile module, TypeDefinitionHandle handle, TypeDefinition typeDefinition, MetadataGenericContext genericContext) { output.WriteReference(module, handle, ".class", isDefinition: true); WriteMetadataToken(output, module, handle, MetadataTokens.GetToken(handle), @@ -1696,7 +1696,7 @@ namespace ICSharpCode.Decompiler.Disassembler } } - void WriteTypeParameters(ITextOutput output, PEFile module, GenericContext context, GenericParameterHandleCollection p) + void WriteTypeParameters(ITextOutput output, PEFile module, MetadataGenericContext context, GenericParameterHandleCollection p) { if (p.Count > 0) { @@ -1755,7 +1755,7 @@ namespace ICSharpCode.Decompiler.Disassembler { output.Write(".custom "); var attr = metadata.GetCustomAttribute(a); - attr.Constructor.WriteTo(module, output, GenericContext.Empty); + attr.Constructor.WriteTo(module, output, default); if (!attr.Value.IsNil) { output.Write(" = "); diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj index 70b4090ba..c6d22df56 100644 --- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj +++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj @@ -120,6 +120,8 @@ + + @@ -353,7 +355,7 @@ - + diff --git a/ICSharpCode.Decompiler/IL/InstructionOutputExtensions.cs b/ICSharpCode.Decompiler/IL/InstructionOutputExtensions.cs index b5f857cf1..75579f41d 100644 --- a/ICSharpCode.Decompiler/IL/InstructionOutputExtensions.cs +++ b/ICSharpCode.Decompiler/IL/InstructionOutputExtensions.cs @@ -69,7 +69,7 @@ namespace ICSharpCode.Decompiler.IL output.Write($"[{interval.Start:x4}..{interval.InclusiveEnd:x4}] "); } - public static void WriteTo(this EntityHandle entity, PEFile module, ITextOutput output, Metadata.GenericContext genericContext, ILNameSyntax syntax = ILNameSyntax.Signature) + public static void WriteTo(this EntityHandle entity, PEFile module, ITextOutput output, Metadata.MetadataGenericContext genericContext, ILNameSyntax syntax = ILNameSyntax.Signature) { if (entity.IsNil) { @@ -138,10 +138,10 @@ namespace ICSharpCode.Decompiler.IL case HandleKind.FieldDefinition: { var fd = metadata.GetFieldDefinition((FieldDefinitionHandle)entity); - signature = fd.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), new Metadata.GenericContext(fd.GetDeclaringType(), module)); + signature = fd.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), new Metadata.MetadataGenericContext(fd.GetDeclaringType(), module)); signature(ILNameSyntax.SignatureNoNamedTypeParameters); output.Write(' '); - ((EntityHandle)fd.GetDeclaringType()).WriteTo(module, output, Metadata.GenericContext.Empty, ILNameSyntax.TypeName); + ((EntityHandle)fd.GetDeclaringType()).WriteTo(module, output, default, ILNameSyntax.TypeName); output.Write("::"); output.WriteReference(module, entity, DisassemblerHelpers.Escape(metadata.GetString(fd.Name))); break; @@ -149,7 +149,7 @@ namespace ICSharpCode.Decompiler.IL case HandleKind.MethodDefinition: { var md = metadata.GetMethodDefinition((MethodDefinitionHandle)entity); - methodSignature = md.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), new Metadata.GenericContext((MethodDefinitionHandle)entity, module)); + methodSignature = md.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), new Metadata.MetadataGenericContext((MethodDefinitionHandle)entity, module)); methodSignature.Header.WriteTo(output); methodSignature.ReturnType(ILNameSyntax.SignatureNoNamedTypeParameters); output.Write(' '); @@ -198,7 +198,7 @@ namespace ICSharpCode.Decompiler.IL if (j > 0) output.Write(", "); var constraint = metadata.GetGenericParameterConstraint(constraints[j]); - constraint.Type.WriteTo(module, output, new Metadata.GenericContext((MethodDefinitionHandle)entity, module), ILNameSyntax.TypeName); + constraint.Type.WriteTo(module, output, new Metadata.MetadataGenericContext((MethodDefinitionHandle)entity, module), ILNameSyntax.TypeName); } output.Write(") "); } @@ -352,7 +352,7 @@ namespace ICSharpCode.Decompiler.IL } } - static void WriteParent(ITextOutput output, PEFile module, MetadataReader metadata, EntityHandle parentHandle, Metadata.GenericContext genericContext, ILNameSyntax syntax) + static void WriteParent(ITextOutput output, PEFile module, MetadataReader metadata, EntityHandle parentHandle, Metadata.MetadataGenericContext genericContext, ILNameSyntax syntax) { switch (parentHandle.Kind) { diff --git a/ICSharpCode.Decompiler/Metadata/Dom.cs b/ICSharpCode.Decompiler/Metadata/Dom.cs deleted file mode 100644 index f77e18375..000000000 --- a/ICSharpCode.Decompiler/Metadata/Dom.cs +++ /dev/null @@ -1,312 +0,0 @@ -#nullable enable - -using System; -using System.Collections.Immutable; -using System.IO; -using System.Reflection; -using System.Reflection.Metadata; -using System.Reflection.Metadata.Ecma335; -using System.Reflection.PortableExecutable; - -using ICSharpCode.Decompiler.TypeSystem; -using ICSharpCode.Decompiler.Util; - -namespace ICSharpCode.Decompiler.Metadata -{ - public enum TargetRuntime - { - Unknown, - Net_1_0, - Net_1_1, - Net_2_0, - Net_4_0 - } - - public enum ResourceType - { - Linked, - Embedded, - AssemblyLinked, - } - - public abstract class Resource - { - public virtual ResourceType ResourceType => ResourceType.Embedded; - public virtual ManifestResourceAttributes Attributes => ManifestResourceAttributes.Public; - public abstract string Name { get; } - public abstract Stream? TryOpenStream(); - } - - public class ByteArrayResource : Resource - { - public override string Name { get; } - byte[] data; - - public ByteArrayResource(string name, byte[] data) - { - this.Name = name ?? throw new ArgumentNullException(nameof(name)); - this.data = data ?? throw new ArgumentNullException(nameof(data)); - } - - public override Stream TryOpenStream() - { - return new MemoryStream(data); - } - } - - sealed class MetadataResource : Resource - { - public PEFile Module { get; } - public ManifestResourceHandle Handle { get; } - public bool IsNil => Handle.IsNil; - - public MetadataResource(PEFile module, ManifestResourceHandle handle) - { - this.Module = module ?? throw new ArgumentNullException(nameof(module)); - this.Handle = handle; - } - - ManifestResource This() => Module.Metadata.GetManifestResource(Handle); - - public bool Equals(MetadataResource other) - { - return Module == other.Module && Handle == other.Handle; - } - - public override bool Equals(object obj) - { - if (obj is MetadataResource res) - return Equals(res); - return false; - } - - public override int GetHashCode() - { - return unchecked(982451629 * Module.GetHashCode() + 982451653 * MetadataTokens.GetToken(Handle)); - } - - public override string Name => Module.Metadata.GetString(This().Name); - - public override ManifestResourceAttributes Attributes => This().Attributes; - public bool HasFlag(ManifestResourceAttributes flag) => (Attributes & flag) == flag; - public override ResourceType ResourceType => GetResourceType(); - - ResourceType GetResourceType() - { - if (This().Implementation.IsNil) - return ResourceType.Embedded; - if (This().Implementation.Kind == HandleKind.AssemblyReference) - return ResourceType.AssemblyLinked; - return ResourceType.Linked; - } - - public override unsafe Stream? TryOpenStream() - { - if (ResourceType != ResourceType.Embedded) - return null; - var headers = Module.Reader.PEHeaders; - if (headers.CorHeader == null) - return null; - var resources = headers.CorHeader.ResourcesDirectory; - if (resources.RelativeVirtualAddress == 0) - return null; - var sectionData = Module.Reader.GetSectionData(resources.RelativeVirtualAddress); - if (sectionData.Length == 0) - throw new BadImageFormatException("RVA could not be found in any section!"); - var reader = sectionData.GetReader(); - reader.Offset += (int)This().Offset; - int length = reader.ReadInt32(); - if (length < 0 || length > reader.RemainingBytes) - throw new BadImageFormatException("Resource stream length invalid"); - return new ResourceMemoryStream(Module.Reader, reader.CurrentPointer, length); - } - } - - sealed unsafe class ResourceMemoryStream : UnmanagedMemoryStream - { - readonly PEReader peReader; - - public ResourceMemoryStream(PEReader peReader, byte* data, long length) - : base(data, length, length, FileAccess.Read) - { - // Keep the PEReader alive while the stream in in use. - this.peReader = peReader; - } - } - - public sealed class FullTypeNameSignatureDecoder : ISignatureTypeProvider, ICustomAttributeTypeProvider - { - readonly MetadataReader metadata; - - public FullTypeNameSignatureDecoder(MetadataReader metadata) - { - this.metadata = metadata; - } - - public FullTypeName GetArrayType(FullTypeName elementType, ArrayShape shape) - { - return elementType; - } - - public FullTypeName GetByReferenceType(FullTypeName elementType) - { - return elementType; - } - - public FullTypeName GetFunctionPointerType(MethodSignature signature) - { - return default; - } - - public FullTypeName GetGenericInstantiation(FullTypeName genericType, ImmutableArray typeArguments) - { - return genericType; - } - - public FullTypeName GetGenericMethodParameter(Unit genericContext, int index) - { - return default; - } - - public FullTypeName GetGenericTypeParameter(Unit genericContext, int index) - { - return default; - } - - public FullTypeName GetModifiedType(FullTypeName modifier, FullTypeName unmodifiedType, bool isRequired) - { - return unmodifiedType; - } - - public FullTypeName GetPinnedType(FullTypeName elementType) - { - return elementType; - } - - public FullTypeName GetPointerType(FullTypeName elementType) - { - return elementType; - } - - public FullTypeName GetPrimitiveType(PrimitiveTypeCode typeCode) - { - var ktr = KnownTypeReference.Get(typeCode.ToKnownTypeCode()); - if (ktr == null) - return default; - return new TopLevelTypeName(ktr.Namespace, ktr.Name, ktr.TypeParameterCount); - } - - public FullTypeName GetSystemType() - { - return new TopLevelTypeName("System", "Type"); - } - - public FullTypeName GetSZArrayType(FullTypeName elementType) - { - return elementType; - } - - public FullTypeName GetTypeFromDefinition(MetadataReader reader, TypeDefinitionHandle handle, byte rawTypeKind) - { - return handle.GetFullTypeName(reader); - } - - public FullTypeName GetTypeFromReference(MetadataReader reader, TypeReferenceHandle handle, byte rawTypeKind) - { - return handle.GetFullTypeName(reader); - } - - public FullTypeName GetTypeFromSerializedName(string name) - { - return new FullTypeName(name); - } - - public FullTypeName GetTypeFromSpecification(MetadataReader reader, Unit genericContext, TypeSpecificationHandle handle, byte rawTypeKind) - { - return reader.GetTypeSpecification(handle).DecodeSignature(new FullTypeNameSignatureDecoder(metadata), default); - } - - public PrimitiveTypeCode GetUnderlyingEnumType(FullTypeName type) - { - throw new NotImplementedException(); - } - - public bool IsSystemType(FullTypeName type) - { - return type.IsKnownType(KnownTypeCode.Type); - } - } - - public class GenericContext - { - readonly MetadataReader? metadata; - readonly TypeDefinitionHandle declaringType; - readonly MethodDefinitionHandle method; - - public static readonly GenericContext Empty = new GenericContext(); - - private GenericContext() { } - - public GenericContext(MethodDefinitionHandle method, PEFile module) - { - this.metadata = module.Metadata; - this.method = method; - this.declaringType = module.Metadata.GetMethodDefinition(method).GetDeclaringType(); - } - - public GenericContext(MethodDefinitionHandle method, MetadataReader metadata) - { - this.metadata = metadata; - this.method = method; - this.declaringType = metadata.GetMethodDefinition(method).GetDeclaringType(); - } - - public GenericContext(TypeDefinitionHandle declaringType, PEFile module) - { - this.metadata = module.Metadata; - this.declaringType = declaringType; - } - - public GenericContext(TypeDefinitionHandle declaringType, MetadataReader metadata) - { - this.metadata = metadata; - this.declaringType = declaringType; - } - - public string GetGenericTypeParameterName(int index) - { - GenericParameterHandle genericParameter = GetGenericTypeParameterHandleOrNull(index); - if (genericParameter.IsNil || metadata == null) - return index.ToString(); - return metadata.GetString(metadata.GetGenericParameter(genericParameter).Name); - } - - public string GetGenericMethodTypeParameterName(int index) - { - GenericParameterHandle genericParameter = GetGenericMethodTypeParameterHandleOrNull(index); - if (genericParameter.IsNil || metadata == null) - return index.ToString(); - return metadata.GetString(metadata.GetGenericParameter(genericParameter).Name); - } - - public GenericParameterHandle GetGenericTypeParameterHandleOrNull(int index) - { - if (declaringType.IsNil || index < 0 || metadata == null) - return MetadataTokens.GenericParameterHandle(0); - var genericParameters = metadata.GetTypeDefinition(declaringType).GetGenericParameters(); - if (index >= genericParameters.Count) - return MetadataTokens.GenericParameterHandle(0); - return genericParameters[index]; - } - - public GenericParameterHandle GetGenericMethodTypeParameterHandleOrNull(int index) - { - if (method.IsNil || index < 0 || metadata == null) - return MetadataTokens.GenericParameterHandle(0); - var genericParameters = metadata.GetMethodDefinition(method).GetGenericParameters(); - if (index >= genericParameters.Count) - return MetadataTokens.GenericParameterHandle(0); - return genericParameters[index]; - } - } -} diff --git a/ICSharpCode.Decompiler/Metadata/FullTypeNameSignatureDecoder.cs b/ICSharpCode.Decompiler/Metadata/FullTypeNameSignatureDecoder.cs new file mode 100644 index 000000000..bdcd767c4 --- /dev/null +++ b/ICSharpCode.Decompiler/Metadata/FullTypeNameSignatureDecoder.cs @@ -0,0 +1,132 @@ +// Copyright (c) 2018 Siegfried Pammer +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +#nullable enable + +using System; +using System.Collections.Immutable; +using System.Reflection.Metadata; + +using ICSharpCode.Decompiler.TypeSystem; +using ICSharpCode.Decompiler.Util; + +namespace ICSharpCode.Decompiler.Metadata +{ + public sealed class FullTypeNameSignatureDecoder : ISignatureTypeProvider, ICustomAttributeTypeProvider + { + readonly MetadataReader metadata; + + public FullTypeNameSignatureDecoder(MetadataReader metadata) + { + this.metadata = metadata; + } + + public FullTypeName GetArrayType(FullTypeName elementType, ArrayShape shape) + { + return elementType; + } + + public FullTypeName GetByReferenceType(FullTypeName elementType) + { + return elementType; + } + + public FullTypeName GetFunctionPointerType(MethodSignature signature) + { + return default; + } + + public FullTypeName GetGenericInstantiation(FullTypeName genericType, ImmutableArray typeArguments) + { + return genericType; + } + + public FullTypeName GetGenericMethodParameter(Unit genericContext, int index) + { + return default; + } + + public FullTypeName GetGenericTypeParameter(Unit genericContext, int index) + { + return default; + } + + public FullTypeName GetModifiedType(FullTypeName modifier, FullTypeName unmodifiedType, bool isRequired) + { + return unmodifiedType; + } + + public FullTypeName GetPinnedType(FullTypeName elementType) + { + return elementType; + } + + public FullTypeName GetPointerType(FullTypeName elementType) + { + return elementType; + } + + public FullTypeName GetPrimitiveType(PrimitiveTypeCode typeCode) + { + var ktr = KnownTypeReference.Get(typeCode.ToKnownTypeCode()); + if (ktr == null) + return default; + return new TopLevelTypeName(ktr.Namespace, ktr.Name, ktr.TypeParameterCount); + } + + public FullTypeName GetSystemType() + { + return new TopLevelTypeName("System", "Type"); + } + + public FullTypeName GetSZArrayType(FullTypeName elementType) + { + return elementType; + } + + public FullTypeName GetTypeFromDefinition(MetadataReader reader, TypeDefinitionHandle handle, byte rawTypeKind) + { + return handle.GetFullTypeName(reader); + } + + public FullTypeName GetTypeFromReference(MetadataReader reader, TypeReferenceHandle handle, byte rawTypeKind) + { + return handle.GetFullTypeName(reader); + } + + public FullTypeName GetTypeFromSerializedName(string name) + { + return new FullTypeName(name); + } + + public FullTypeName GetTypeFromSpecification(MetadataReader reader, Unit genericContext, TypeSpecificationHandle handle, byte rawTypeKind) + { + return reader.GetTypeSpecification(handle).DecodeSignature(new FullTypeNameSignatureDecoder(metadata), default); + } + + public PrimitiveTypeCode GetUnderlyingEnumType(FullTypeName type) + { + throw new NotImplementedException(); + } + + public bool IsSystemType(FullTypeName type) + { + return type.IsKnownType(KnownTypeCode.Type); + } + } +} diff --git a/ICSharpCode.Decompiler/Metadata/MetadataGenericContext.cs b/ICSharpCode.Decompiler/Metadata/MetadataGenericContext.cs new file mode 100644 index 000000000..b64757972 --- /dev/null +++ b/ICSharpCode.Decompiler/Metadata/MetadataGenericContext.cs @@ -0,0 +1,96 @@ +// Copyright (c) 2018 Siegfried Pammer +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +#nullable enable + +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; + +namespace ICSharpCode.Decompiler.Metadata +{ + public readonly struct MetadataGenericContext + { + readonly MetadataReader? metadata; + readonly TypeDefinitionHandle declaringType; + readonly MethodDefinitionHandle method; + + public MetadataGenericContext(MethodDefinitionHandle method, PEFile module) + { + this.metadata = module.Metadata; + this.method = method; + this.declaringType = module.Metadata.GetMethodDefinition(method).GetDeclaringType(); + } + + public MetadataGenericContext(MethodDefinitionHandle method, MetadataReader metadata) + { + this.metadata = metadata; + this.method = method; + this.declaringType = metadata.GetMethodDefinition(method).GetDeclaringType(); + } + + public MetadataGenericContext(TypeDefinitionHandle declaringType, PEFile module) + { + this.metadata = module.Metadata; + this.method = default; + this.declaringType = declaringType; + } + + public MetadataGenericContext(TypeDefinitionHandle declaringType, MetadataReader metadata) + { + this.metadata = metadata; + this.method = default; + this.declaringType = declaringType; + } + + public string GetGenericTypeParameterName(int index) + { + GenericParameterHandle genericParameter = GetGenericTypeParameterHandleOrNull(index); + if (genericParameter.IsNil || metadata == null) + return index.ToString(); + return metadata.GetString(metadata.GetGenericParameter(genericParameter).Name); + } + + public string GetGenericMethodTypeParameterName(int index) + { + GenericParameterHandle genericParameter = GetGenericMethodTypeParameterHandleOrNull(index); + if (genericParameter.IsNil || metadata == null) + return index.ToString(); + return metadata.GetString(metadata.GetGenericParameter(genericParameter).Name); + } + + public GenericParameterHandle GetGenericTypeParameterHandleOrNull(int index) + { + if (declaringType.IsNil || index < 0 || metadata == null) + return MetadataTokens.GenericParameterHandle(0); + var genericParameters = metadata.GetTypeDefinition(declaringType).GetGenericParameters(); + if (index >= genericParameters.Count) + return MetadataTokens.GenericParameterHandle(0); + return genericParameters[index]; + } + + public GenericParameterHandle GetGenericMethodTypeParameterHandleOrNull(int index) + { + if (method.IsNil || index < 0 || metadata == null) + return MetadataTokens.GenericParameterHandle(0); + var genericParameters = metadata.GetMethodDefinition(method).GetGenericParameters(); + if (index >= genericParameters.Count) + return MetadataTokens.GenericParameterHandle(0); + return genericParameters[index]; + } + } +} diff --git a/ICSharpCode.Decompiler/Metadata/Resource.cs b/ICSharpCode.Decompiler/Metadata/Resource.cs new file mode 100644 index 000000000..9eec0959e --- /dev/null +++ b/ICSharpCode.Decompiler/Metadata/Resource.cs @@ -0,0 +1,143 @@ +// Copyright (c) 2018 Daniel Grunwald +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +#nullable enable + +using System; +using System.IO; +using System.Reflection; +using System.Reflection.Metadata; +using System.Reflection.Metadata.Ecma335; +using System.Reflection.PortableExecutable; + +namespace ICSharpCode.Decompiler.Metadata +{ + public enum ResourceType + { + Linked, + Embedded, + AssemblyLinked, + } + + public abstract class Resource + { + public virtual ResourceType ResourceType => ResourceType.Embedded; + public virtual ManifestResourceAttributes Attributes => ManifestResourceAttributes.Public; + public abstract string Name { get; } + public abstract Stream? TryOpenStream(); + } + + public class ByteArrayResource : Resource + { + public override string Name { get; } + byte[] data; + + public ByteArrayResource(string name, byte[] data) + { + this.Name = name ?? throw new ArgumentNullException(nameof(name)); + this.data = data ?? throw new ArgumentNullException(nameof(data)); + } + + public override Stream TryOpenStream() + { + return new MemoryStream(data); + } + } + + sealed class MetadataResource : Resource + { + public PEFile Module { get; } + public ManifestResourceHandle Handle { get; } + public bool IsNil => Handle.IsNil; + + public MetadataResource(PEFile module, ManifestResourceHandle handle) + { + this.Module = module ?? throw new ArgumentNullException(nameof(module)); + this.Handle = handle; + } + + ManifestResource This() => Module.Metadata.GetManifestResource(Handle); + + public bool Equals(MetadataResource other) + { + return Module == other.Module && Handle == other.Handle; + } + + public override bool Equals(object? obj) + { + if (obj is MetadataResource res) + return Equals(res); + return false; + } + + public override int GetHashCode() + { + return unchecked(982451629 * Module.GetHashCode() + 982451653 * MetadataTokens.GetToken(Handle)); + } + + public override string Name => Module.Metadata.GetString(This().Name); + + public override ManifestResourceAttributes Attributes => This().Attributes; + public bool HasFlag(ManifestResourceAttributes flag) => (Attributes & flag) == flag; + public override ResourceType ResourceType => GetResourceType(); + + ResourceType GetResourceType() + { + if (This().Implementation.IsNil) + return ResourceType.Embedded; + if (This().Implementation.Kind == HandleKind.AssemblyReference) + return ResourceType.AssemblyLinked; + return ResourceType.Linked; + } + + public override unsafe Stream? TryOpenStream() + { + if (ResourceType != ResourceType.Embedded) + return null; + var headers = Module.Reader.PEHeaders; + if (headers.CorHeader == null) + return null; + var resources = headers.CorHeader.ResourcesDirectory; + if (resources.RelativeVirtualAddress == 0) + return null; + var sectionData = Module.Reader.GetSectionData(resources.RelativeVirtualAddress); + if (sectionData.Length == 0) + throw new BadImageFormatException("RVA could not be found in any section!"); + var reader = sectionData.GetReader(); + reader.Offset += (int)This().Offset; + int length = reader.ReadInt32(); + if (length < 0 || length > reader.RemainingBytes) + throw new BadImageFormatException("Resource stream length invalid"); + return new ResourceMemoryStream(Module.Reader, reader.CurrentPointer, length); + } + } + + sealed unsafe class ResourceMemoryStream : UnmanagedMemoryStream + { +#pragma warning disable IDE0052 // Remove unread private members + readonly PEReader peReader; +#pragma warning restore IDE0052 // Remove unread private members + + public ResourceMemoryStream(PEReader peReader, byte* data, long length) + : base(data, length, length, FileAccess.Read) + { + // Keep the PEReader alive while the stream in in use. + this.peReader = peReader; + } + } +} diff --git a/ICSharpCode.Decompiler/Metadata/UniversalAssemblyResolver.cs b/ICSharpCode.Decompiler/Metadata/UniversalAssemblyResolver.cs index 48761958c..78e3fe3f8 100644 --- a/ICSharpCode.Decompiler/Metadata/UniversalAssemblyResolver.cs +++ b/ICSharpCode.Decompiler/Metadata/UniversalAssemblyResolver.cs @@ -31,6 +31,15 @@ using System.Threading.Tasks; namespace ICSharpCode.Decompiler.Metadata { + public enum TargetRuntime + { + Unknown, + Net_1_0, + Net_1_1, + Net_2_0, + Net_4_0 + } + public enum TargetFrameworkIdentifier { NETFramework, diff --git a/ILSpy.ReadyToRun/ReadyToRunDisassembler.cs b/ILSpy.ReadyToRun/ReadyToRunDisassembler.cs index 7d67f4763..6cf7b0648 100644 --- a/ILSpy.ReadyToRun/ReadyToRunDisassembler.cs +++ b/ILSpy.ReadyToRun/ReadyToRunDisassembler.cs @@ -433,7 +433,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun output.WriteReference(currentFile, methodDefToken, $"({MetadataTokens.GetToken(methodDefToken):X8}) ", "metadata"); } } - methodDefToken.WriteTo(currentFile, output, Decompiler.Metadata.GenericContext.Empty); + methodDefToken.WriteTo(currentFile, output, default); break; case MethodRefEntrySignature methodRefSignature: var methodRefToken = MetadataTokens.EntityHandle(unchecked((int)methodRefSignature.MethodRefToken)); @@ -448,7 +448,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun output.WriteReference(currentFile, methodRefToken, $"({MetadataTokens.GetToken(methodRefToken):X8}) ", "metadata"); } } - methodRefToken.WriteTo(currentFile, output, Decompiler.Metadata.GenericContext.Empty); + methodRefToken.WriteTo(currentFile, output, default); break; default: output.WriteLine(reader.ImportSignatures[importCellAddress].ToString(new SignatureFormattingOptions())); diff --git a/ILSpy/Metadata/CorTables/ClassLayoutTableTreeNode.cs b/ILSpy/Metadata/CorTables/ClassLayoutTableTreeNode.cs index b8dd878d3..97be91596 100644 --- a/ILSpy/Metadata/CorTables/ClassLayoutTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/ClassLayoutTableTreeNode.cs @@ -112,7 +112,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ParentTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)classLayout.Parent).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/ConstantTableTreeNode.cs b/ILSpy/Metadata/CorTables/ConstantTableTreeNode.cs index 3129e18cb..0493abd8f 100644 --- a/ILSpy/Metadata/CorTables/ConstantTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/ConstantTableTreeNode.cs @@ -104,7 +104,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ParentTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); constant.Parent.WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/CustomAttributeTableTreeNode.cs b/ILSpy/Metadata/CorTables/CustomAttributeTableTreeNode.cs index ace446254..4070ad9be 100644 --- a/ILSpy/Metadata/CorTables/CustomAttributeTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/CustomAttributeTableTreeNode.cs @@ -99,7 +99,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ParentTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); customAttr.Parent.WriteTo(module, output, context); return output.ToString(); } @@ -117,7 +117,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ConstructorTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); customAttr.Constructor.WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/DeclSecurityTableTreeNode.cs b/ILSpy/Metadata/CorTables/DeclSecurityTableTreeNode.cs index 7b7eca7bb..bcfb719ad 100644 --- a/ILSpy/Metadata/CorTables/DeclSecurityTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/DeclSecurityTableTreeNode.cs @@ -100,7 +100,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ParentTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); declSecAttr.Parent.WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/EventMapTableTreeNode.cs b/ILSpy/Metadata/CorTables/EventMapTableTreeNode.cs index f622412de..d25738f72 100644 --- a/ILSpy/Metadata/CorTables/EventMapTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/EventMapTableTreeNode.cs @@ -110,7 +110,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ParentTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)eventMap.Parent).WriteTo(module, output, context); return output.ToString(); } @@ -128,7 +128,7 @@ namespace ICSharpCode.ILSpy.Metadata public string EventListTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)eventMap.EventList).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/EventTableTreeNode.cs b/ILSpy/Metadata/CorTables/EventTableTreeNode.cs index 468df5590..4ed3b9a84 100644 --- a/ILSpy/Metadata/CorTables/EventTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/EventTableTreeNode.cs @@ -115,7 +115,7 @@ namespace ICSharpCode.ILSpy.Metadata public string TypeTooltip { get { ITextOutput output = new PlainTextOutput(); - eventDef.Type.WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); + eventDef.Type.WriteTo(module, output, default); return output.ToString(); } } diff --git a/ILSpy/Metadata/CorTables/ExportedTypeTableTreeNode.cs b/ILSpy/Metadata/CorTables/ExportedTypeTableTreeNode.cs index 54203cb50..fee2aff10 100644 --- a/ILSpy/Metadata/CorTables/ExportedTypeTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/ExportedTypeTableTreeNode.cs @@ -124,7 +124,7 @@ namespace ICSharpCode.ILSpy.Metadata if (type.Implementation.IsNil) return null; ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); type.Implementation.WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/FieldLayoutTableTreeNode.cs b/ILSpy/Metadata/CorTables/FieldLayoutTableTreeNode.cs index 73944d109..d959a49b6 100644 --- a/ILSpy/Metadata/CorTables/FieldLayoutTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/FieldLayoutTableTreeNode.cs @@ -110,7 +110,7 @@ namespace ICSharpCode.ILSpy.Metadata public string FieldTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)fieldLayout.Field).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/FieldMarshalTableTreeNode.cs b/ILSpy/Metadata/CorTables/FieldMarshalTableTreeNode.cs index 57a5923fc..a4d74b9bc 100644 --- a/ILSpy/Metadata/CorTables/FieldMarshalTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/FieldMarshalTableTreeNode.cs @@ -110,7 +110,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ParentTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)fieldMarshal.Parent).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/FieldRVATableTreeNode.cs b/ILSpy/Metadata/CorTables/FieldRVATableTreeNode.cs index 926ce92bd..c0d54a023 100644 --- a/ILSpy/Metadata/CorTables/FieldRVATableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/FieldRVATableTreeNode.cs @@ -110,7 +110,7 @@ namespace ICSharpCode.ILSpy.Metadata public string FieldTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)fieldLayout.Field).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/FieldTableTreeNode.cs b/ILSpy/Metadata/CorTables/FieldTableTreeNode.cs index 6d5beb3ed..bdc927b28 100644 --- a/ILSpy/Metadata/CorTables/FieldTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/FieldTableTreeNode.cs @@ -116,7 +116,7 @@ namespace ICSharpCode.ILSpy.Metadata public string SignatureTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)handle).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/GenericParamConstraintTableTreeNode.cs b/ILSpy/Metadata/CorTables/GenericParamConstraintTableTreeNode.cs index defb77e41..760cb2df1 100644 --- a/ILSpy/Metadata/CorTables/GenericParamConstraintTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/GenericParamConstraintTableTreeNode.cs @@ -104,7 +104,7 @@ namespace ICSharpCode.ILSpy.Metadata ITextOutput output = new PlainTextOutput(); var p = metadata.GetGenericParameter(genericParamConstraint.Parameter); output.Write("parameter " + p.Index + (p.Name.IsNil ? "" : " (" + metadata.GetString(p.Name) + ")") + " of "); - p.Parent.WriteTo(module, output, GenericContext.Empty); + p.Parent.WriteTo(module, output, default); ownerTooltip = output.ToString(); } return ownerTooltip; @@ -123,7 +123,7 @@ namespace ICSharpCode.ILSpy.Metadata public string TypeTooltip { get { ITextOutput output = new PlainTextOutput(); - genericParamConstraint.Type.WriteTo(module, output, GenericContext.Empty); + genericParamConstraint.Type.WriteTo(module, output, default); return output.ToString(); } } diff --git a/ILSpy/Metadata/CorTables/GenericParamTableTreeNode.cs b/ILSpy/Metadata/CorTables/GenericParamTableTreeNode.cs index 99c78ba34..5bb682d2b 100644 --- a/ILSpy/Metadata/CorTables/GenericParamTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/GenericParamTableTreeNode.cs @@ -108,7 +108,7 @@ namespace ICSharpCode.ILSpy.Metadata public string OwnerTooltip { get { ITextOutput output = new PlainTextOutput(); - genericParam.Parent.WriteTo(module, output, GenericContext.Empty); + genericParam.Parent.WriteTo(module, output, default); return output.ToString(); } } diff --git a/ILSpy/Metadata/CorTables/ImplMapTableTreeNode.cs b/ILSpy/Metadata/CorTables/ImplMapTableTreeNode.cs index 5afb3e686..ccfd7801b 100644 --- a/ILSpy/Metadata/CorTables/ImplMapTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/ImplMapTableTreeNode.cs @@ -127,7 +127,7 @@ namespace ICSharpCode.ILSpy.Metadata public string MemberForwardedTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)implMap.MemberForwarded).WriteTo(module, output, context); return output.ToString(); } @@ -145,7 +145,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ImportScopeTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)implMap.ImportScope).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/InterfaceImplTableTreeNode.cs b/ILSpy/Metadata/CorTables/InterfaceImplTableTreeNode.cs index 691678ad1..6f5090032 100644 --- a/ILSpy/Metadata/CorTables/InterfaceImplTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/InterfaceImplTableTreeNode.cs @@ -110,7 +110,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ClassTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)interfaceImpl.Class).WriteTo(module, output, context); return output.ToString(); } @@ -128,7 +128,7 @@ namespace ICSharpCode.ILSpy.Metadata public string InterfaceTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)interfaceImpl.Interface).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/ManifestResourceTableTreeNode.cs b/ILSpy/Metadata/CorTables/ManifestResourceTableTreeNode.cs index eb67c87db..e720ee1c1 100644 --- a/ILSpy/Metadata/CorTables/ManifestResourceTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/ManifestResourceTableTreeNode.cs @@ -111,7 +111,7 @@ namespace ICSharpCode.ILSpy.Metadata if (manifestResource.Implementation.IsNil) return null; ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); manifestResource.Implementation.WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/MemberRefTableTreeNode.cs b/ILSpy/Metadata/CorTables/MemberRefTableTreeNode.cs index 735939b25..5c4987846 100644 --- a/ILSpy/Metadata/CorTables/MemberRefTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/MemberRefTableTreeNode.cs @@ -99,7 +99,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ParentTooltip { get { ITextOutput output = new PlainTextOutput(); - memberRef.Parent.WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); + memberRef.Parent.WriteTo(module, output, default); return output.ToString(); } } @@ -114,7 +114,7 @@ namespace ICSharpCode.ILSpy.Metadata public string SignatureTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)handle).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/MethodImplTableTreeNode.cs b/ILSpy/Metadata/CorTables/MethodImplTableTreeNode.cs index d3fb88b0a..bd7292df8 100644 --- a/ILSpy/Metadata/CorTables/MethodImplTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/MethodImplTableTreeNode.cs @@ -98,7 +98,7 @@ namespace ICSharpCode.ILSpy.Metadata public string MethodDeclarationTooltip { get { ITextOutput output = new PlainTextOutput(); - methodImpl.MethodDeclaration.WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); + methodImpl.MethodDeclaration.WriteTo(module, output, default); return output.ToString(); } } @@ -115,7 +115,7 @@ namespace ICSharpCode.ILSpy.Metadata public string MethodBodyTooltip { get { ITextOutput output = new PlainTextOutput(); - methodImpl.MethodBody.WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); + methodImpl.MethodBody.WriteTo(module, output, default); return output.ToString(); } } @@ -132,7 +132,7 @@ namespace ICSharpCode.ILSpy.Metadata public string TypeTooltip { get { ITextOutput output = new PlainTextOutput(); - ((EntityHandle)methodImpl.Type).WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); + ((EntityHandle)methodImpl.Type).WriteTo(module, output, default); return output.ToString(); } } diff --git a/ILSpy/Metadata/CorTables/MethodSemanticsTableTreeNode.cs b/ILSpy/Metadata/CorTables/MethodSemanticsTableTreeNode.cs index 8e24f77fc..73316effc 100644 --- a/ILSpy/Metadata/CorTables/MethodSemanticsTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/MethodSemanticsTableTreeNode.cs @@ -107,7 +107,7 @@ namespace ICSharpCode.ILSpy.Metadata public string MethodTooltip { get { ITextOutput output = new PlainTextOutput(); - ((EntityHandle)method).WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); + ((EntityHandle)method).WriteTo(module, output, default); return output.ToString(); } } @@ -124,7 +124,7 @@ namespace ICSharpCode.ILSpy.Metadata public string AssociationTooltip { get { ITextOutput output = new PlainTextOutput(); - association.WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); + association.WriteTo(module, output, default); return output.ToString(); } } diff --git a/ILSpy/Metadata/CorTables/MethodSpecTableTreeNode.cs b/ILSpy/Metadata/CorTables/MethodSpecTableTreeNode.cs index 9a27a6f90..702f66594 100644 --- a/ILSpy/Metadata/CorTables/MethodSpecTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/MethodSpecTableTreeNode.cs @@ -99,7 +99,7 @@ namespace ICSharpCode.ILSpy.Metadata public string MethodTooltip { get { ITextOutput output = new PlainTextOutput(); - methodSpec.Method.WriteTo(module, output, GenericContext.Empty); + methodSpec.Method.WriteTo(module, output, default); return output.ToString(); } } @@ -110,7 +110,7 @@ namespace ICSharpCode.ILSpy.Metadata public string SignatureTooltip { get { ITextOutput output = new PlainTextOutput(); - var signature = methodSpec.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), GenericContext.Empty); + var signature = methodSpec.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), default); bool first = true; foreach (var type in signature) { diff --git a/ILSpy/Metadata/CorTables/MethodTableTreeNode.cs b/ILSpy/Metadata/CorTables/MethodTableTreeNode.cs index 89b3dd90f..c1b1160f2 100644 --- a/ILSpy/Metadata/CorTables/MethodTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/MethodTableTreeNode.cs @@ -127,7 +127,7 @@ namespace ICSharpCode.ILSpy.Metadata if (signatureTooltip == null) { ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)handle).WriteTo(module, output, context); signatureTooltip = output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/NestedClassTableTreeNode.cs b/ILSpy/Metadata/CorTables/NestedClassTableTreeNode.cs index d26ff614d..d9560ab7e 100644 --- a/ILSpy/Metadata/CorTables/NestedClassTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/NestedClassTableTreeNode.cs @@ -110,7 +110,7 @@ namespace ICSharpCode.ILSpy.Metadata public string NestedClassTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)nestedClass.Nested).WriteTo(module, output, context); return output.ToString(); } @@ -128,7 +128,7 @@ namespace ICSharpCode.ILSpy.Metadata public string EnclosingClassTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)nestedClass.Enclosing).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/PropertyMapTableTreeNode.cs b/ILSpy/Metadata/CorTables/PropertyMapTableTreeNode.cs index eeabef516..c4291171f 100644 --- a/ILSpy/Metadata/CorTables/PropertyMapTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/PropertyMapTableTreeNode.cs @@ -110,7 +110,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ParentTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)propertyMap.Parent).WriteTo(module, output, context); return output.ToString(); } @@ -128,7 +128,7 @@ namespace ICSharpCode.ILSpy.Metadata public string PropertyListTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)propertyMap.PropertyList).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/PropertyTableTreeNode.cs b/ILSpy/Metadata/CorTables/PropertyTableTreeNode.cs index dad13c218..39c380806 100644 --- a/ILSpy/Metadata/CorTables/PropertyTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/PropertyTableTreeNode.cs @@ -109,7 +109,7 @@ namespace ICSharpCode.ILSpy.Metadata public string SignatureTooltip { get { ITextOutput output = new PlainTextOutput(); - ((EntityHandle)handle).WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); + ((EntityHandle)handle).WriteTo(module, output, default); return output.ToString(); } } diff --git a/ILSpy/Metadata/CorTables/StandAloneSigTableTreeNode.cs b/ILSpy/Metadata/CorTables/StandAloneSigTableTreeNode.cs index 02ba8159b..ff6fbfb76 100644 --- a/ILSpy/Metadata/CorTables/StandAloneSigTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/StandAloneSigTableTreeNode.cs @@ -92,7 +92,7 @@ namespace ICSharpCode.ILSpy.Metadata public string SignatureTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)handle).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/TypeDefTableTreeNode.cs b/ILSpy/Metadata/CorTables/TypeDefTableTreeNode.cs index 5871712d0..078d8afb0 100644 --- a/ILSpy/Metadata/CorTables/TypeDefTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/TypeDefTableTreeNode.cs @@ -137,7 +137,7 @@ namespace ICSharpCode.ILSpy.Metadata provider.GetTypeFromReference(module.Metadata, (TypeReferenceHandle)typeDef.BaseType, 0)(ILNameSyntax.Signature); return output.ToString(); case HandleKind.TypeSpecification: - provider.GetTypeFromSpecification(module.Metadata, new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module), (TypeSpecificationHandle)typeDef.BaseType, 0)(ILNameSyntax.Signature); + provider.GetTypeFromSpecification(module.Metadata, new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module), (TypeSpecificationHandle)typeDef.BaseType, 0)(ILNameSyntax.Signature); return output.ToString(); default: return null; @@ -160,7 +160,7 @@ namespace ICSharpCode.ILSpy.Metadata if (field.IsNil) return null; ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)field).WriteTo(module, output, context); return output.ToString(); } @@ -181,7 +181,7 @@ namespace ICSharpCode.ILSpy.Metadata if (method.IsNil) return null; ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), module); + var context = new Decompiler.Metadata.MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)method).WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/CorTables/TypeRefTableTreeNode.cs b/ILSpy/Metadata/CorTables/TypeRefTableTreeNode.cs index 39e60f004..24db219f9 100644 --- a/ILSpy/Metadata/CorTables/TypeRefTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/TypeRefTableTreeNode.cs @@ -114,7 +114,7 @@ namespace ICSharpCode.ILSpy.Metadata output.Write(asmRef.ToString()); break; default: - typeRef.ResolutionScope.WriteTo(module, output, GenericContext.Empty); + typeRef.ResolutionScope.WriteTo(module, output, default); break; } return output.ToString(); diff --git a/ILSpy/Metadata/CorTables/TypeSpecTableTreeNode.cs b/ILSpy/Metadata/CorTables/TypeSpecTableTreeNode.cs index f99c64e57..1d19874e5 100644 --- a/ILSpy/Metadata/CorTables/TypeSpecTableTreeNode.cs +++ b/ILSpy/Metadata/CorTables/TypeSpecTableTreeNode.cs @@ -92,7 +92,7 @@ namespace ICSharpCode.ILSpy.Metadata public string SignatureTooltip { get { ITextOutput output = new PlainTextOutput(); - typeSpec.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), GenericContext.Empty)(ILNameSyntax.Signature); + typeSpec.DecodeSignature(new DisassemblerSignatureTypeProvider(module, output), default)(ILNameSyntax.Signature); return output.ToString(); } } diff --git a/ILSpy/Metadata/DebugTables/CustomDebugInformationTableTreeNode.cs b/ILSpy/Metadata/DebugTables/CustomDebugInformationTableTreeNode.cs index d7f88a1d8..47fb5e36e 100644 --- a/ILSpy/Metadata/DebugTables/CustomDebugInformationTableTreeNode.cs +++ b/ILSpy/Metadata/DebugTables/CustomDebugInformationTableTreeNode.cs @@ -202,7 +202,7 @@ namespace ICSharpCode.ILSpy.Metadata public string ParentTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); debugInfo.Parent.WriteTo(module, output, context); return output.ToString(); } diff --git a/ILSpy/Metadata/DebugTables/LocalScopeTableTreeNode.cs b/ILSpy/Metadata/DebugTables/LocalScopeTableTreeNode.cs index e23a5cdcc..e934deadf 100644 --- a/ILSpy/Metadata/DebugTables/LocalScopeTableTreeNode.cs +++ b/ILSpy/Metadata/DebugTables/LocalScopeTableTreeNode.cs @@ -100,7 +100,7 @@ namespace ICSharpCode.ILSpy.Metadata public string MethodTooltip { get { ITextOutput output = new PlainTextOutput(); - ((EntityHandle)localScope.Method).WriteTo(module, output, Decompiler.Metadata.GenericContext.Empty); + ((EntityHandle)localScope.Method).WriteTo(module, output, default); return output.ToString(); } } diff --git a/ILSpy/Metadata/DebugTables/MethodDebugInformationTableTreeNode.cs b/ILSpy/Metadata/DebugTables/MethodDebugInformationTableTreeNode.cs index 047053e87..8ed8b05fb 100644 --- a/ILSpy/Metadata/DebugTables/MethodDebugInformationTableTreeNode.cs +++ b/ILSpy/Metadata/DebugTables/MethodDebugInformationTableTreeNode.cs @@ -134,7 +134,7 @@ namespace ICSharpCode.ILSpy.Metadata if (debugInfo.LocalSignature.IsNil) return null; ITextOutput output = new PlainTextOutput(); - var context = new Decompiler.Metadata.GenericContext(default(TypeDefinitionHandle), metadata); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), metadata); StandaloneSignature localSignature = module.Metadata.GetStandaloneSignature(debugInfo.LocalSignature); var signatureDecoder = new DisassemblerSignatureTypeProvider(module, output); int index = 0; diff --git a/ILSpy/Metadata/DebugTables/StateMachineMethodTableTreeNode.cs b/ILSpy/Metadata/DebugTables/StateMachineMethodTableTreeNode.cs index 4199d3de7..8407f7328 100644 --- a/ILSpy/Metadata/DebugTables/StateMachineMethodTableTreeNode.cs +++ b/ILSpy/Metadata/DebugTables/StateMachineMethodTableTreeNode.cs @@ -102,7 +102,7 @@ namespace ICSharpCode.ILSpy.Metadata public string MoveNextMethodTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)moveNextMethod).WriteTo(module, output, context); return output.ToString(); } @@ -120,7 +120,7 @@ namespace ICSharpCode.ILSpy.Metadata public string KickoffMethodTooltip { get { ITextOutput output = new PlainTextOutput(); - var context = new GenericContext(default(TypeDefinitionHandle), module); + var context = new MetadataGenericContext(default(TypeDefinitionHandle), module); ((EntityHandle)kickoffMethod).WriteTo(module, output, context); return output.ToString(); }