diff options
author | Michal Strehovsky <michals@microsoft.com> | 2017-07-15 00:17:43 +0300 |
---|---|---|
committer | Michal Strehovsky <michals@microsoft.com> | 2017-07-15 00:17:43 +0300 |
commit | 3e6dc26c626ed2c1234d5a72435f931513ba2360 (patch) | |
tree | 6460b7eafbf3304d162807a6be603890ac690783 /src/System.Private.Reflection.Core | |
parent | aad567bc7b3965f4d10e7d5129fce833e5461c24 (diff) |
Make metadata collections no longer implement generic IReadOnlyCollection
This has a positive size on disk impact since generic IEnumerable and IEnumerator interfaces come with a bunch of costs. Low level metadata APIs don't have to be fancy. This also removes a bunch of boxing as an added bonus.
[tfs-changeset: 1666112]
Diffstat (limited to 'src/System.Private.Reflection.Core')
7 files changed, 296 insertions, 69 deletions
diff --git a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseSensitive.cs b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseSensitive.cs index eb54f91f8..b9e05e76c 100644 --- a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseSensitive.cs +++ b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseSensitive.cs @@ -42,7 +42,7 @@ namespace System.Reflection.Runtime.Assemblies.NativeFormat continue; // We've successfully drilled down the namespace chain. Now look for a top-level type matching the type name. - IEnumerable<TypeDefinitionHandle> candidateTypes = namespaceDefinition.TypeDefinitions; + TypeDefinitionHandleCollection candidateTypes = namespaceDefinition.TypeDefinitions; foreach (TypeDefinitionHandle candidateType in candidateTypes) { TypeDefinition typeDefinition = candidateType.GetTypeDefinition(reader); @@ -51,7 +51,7 @@ namespace System.Reflection.Runtime.Assemblies.NativeFormat } // No match found in this assembly - see if there's a matching type forwarder. - IEnumerable<TypeForwarderHandle> candidateTypeForwarders = namespaceDefinition.TypeForwarders; + TypeForwarderHandleCollection candidateTypeForwarders = namespaceDefinition.TypeForwarders; foreach (TypeForwarderHandle typeForwarderHandle in candidateTypeForwarders) { TypeForwarder typeForwarder = typeForwarderHandle.GetTypeForwarder(reader); @@ -72,7 +72,7 @@ namespace System.Reflection.Runtime.Assemblies.NativeFormat private bool TryResolveNamespaceDefinitionCaseSensitive(MetadataReader reader, string[] namespaceParts, ScopeDefinitionHandle scopeDefinitionHandle, out NamespaceDefinition namespaceDefinition) { namespaceDefinition = scopeDefinitionHandle.GetScopeDefinition(reader).RootNamespaceDefinition.GetNamespaceDefinition(reader); - IEnumerable<NamespaceDefinitionHandle> candidates = namespaceDefinition.NamespaceDefinitions; + NamespaceDefinitionHandleCollection candidates = namespaceDefinition.NamespaceDefinitions; int idx = namespaceParts.Length; while (idx-- != 0) { diff --git a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/NativeFormat/NativeFormatCustomAttributeData.cs b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/NativeFormat/NativeFormatCustomAttributeData.cs index 847ef57ee..9c266d344 100644 --- a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/NativeFormat/NativeFormatCustomAttributeData.cs +++ b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/NativeFormat/NativeFormatCustomAttributeData.cs @@ -104,7 +104,7 @@ namespace System.Reflection.Runtime.CustomAttributes.NativeFormat internal sealed override IList<CustomAttributeTypedArgument> GetConstructorArguments(bool throwIfMissingMetadata) { int index = 0; - LowLevelList<Handle> lazyCtorTypeHandles = null; + Handle[] lazyCtorTypeHandles = null; LowLevelListWithIList<CustomAttributeTypedArgument> customAttributeTypedArguments = new LowLevelListWithIList<CustomAttributeTypedArgument>(); foreach (FixedArgumentHandle fixedArgumentHandle in _customAttribute.FixedArguments) @@ -120,7 +120,7 @@ namespace System.Reflection.Runtime.CustomAttributes.NativeFormat // parsing the constructor's signature to get the type info. if (lazyCtorTypeHandles == null) { - IEnumerable<Handle> parameterTypeSignatureHandles; + HandleCollection parameterTypeSignatureHandles; HandleType handleType = _customAttribute.Constructor.HandleType; switch (handleType) { @@ -134,8 +134,7 @@ namespace System.Reflection.Runtime.CustomAttributes.NativeFormat default: throw new BadImageFormatException(); } - LowLevelList<Handle> ctorTypeHandles = new LowLevelList<Handle>(parameterTypeSignatureHandles); - lazyCtorTypeHandles = ctorTypeHandles; + lazyCtorTypeHandles = parameterTypeSignatureHandles.ToArray(); } Handle typeHandle = lazyCtorTypeHandles[index]; Exception exception = null; diff --git a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/Dispensers.NativeFormat.cs b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/Dispensers.NativeFormat.cs index 4250b550d..49832c396 100644 --- a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/Dispensers.NativeFormat.cs +++ b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/Dispensers.NativeFormat.cs @@ -194,7 +194,7 @@ namespace System.Reflection.Runtime.CustomAttributes //----------------------------------------------------------------------------------------------------------- internal abstract partial class RuntimeCustomAttributeData { - internal static IEnumerable<CustomAttributeData> GetCustomAttributes(MetadataReader reader, IEnumerable<CustomAttributeHandle> customAttributeHandles) + internal static IEnumerable<CustomAttributeData> GetCustomAttributes(MetadataReader reader, CustomAttributeHandleCollection customAttributeHandles) { foreach (CustomAttributeHandle customAttributeHandle in customAttributeHandles) yield return GetCustomAttributeData(reader, customAttributeHandle); diff --git a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/Helpers.cs b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/Helpers.cs index 2fb6c449e..5b2620a5b 100644 --- a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/Helpers.cs +++ b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/Helpers.cs @@ -86,35 +86,6 @@ namespace System.Reflection.Runtime.General return new ReadOnlyCollection<T>(enumeration.ToArray()); } - public static T[] ReadOnlyCollectionToArray<T>(this IReadOnlyCollection<T> collection) - { - int count = collection.Count; - T[] result = new T[count]; - int i = 0; - foreach (T element in collection) - { - result[i++] = element; - } - Debug.Assert(i == count); - return result; - } - - public static Array ReadOnlyCollectionToEnumArray<T>(this IReadOnlyCollection<T> collection, Type enumType) where T : struct - { - Debug.Assert(typeof(T).IsPrimitive); - Debug.Assert(enumType.IsEnum); - - int count = collection.Count; - T[] result = (T[])Array.CreateInstance(enumType, count); - int i = 0; - foreach (T element in collection) - { - result[i++] = element; - } - Debug.Assert(i == count); - return result; - } - public static MethodInfo FilterAccessor(this MethodInfo accessor, bool nonPublic) { if (nonPublic) diff --git a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/MetadataReaderExtensions.NativeFormat.cs b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/MetadataReaderExtensions.NativeFormat.cs index bdc9c26df..3dee1cd22 100644 --- a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/MetadataReaderExtensions.NativeFormat.cs +++ b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/MetadataReaderExtensions.NativeFormat.cs @@ -387,68 +387,72 @@ namespace System.Reflection.Runtime.General switch (handleType) { case HandleType.ConstantBooleanArray: - return handle.ToConstantBooleanArrayHandle(reader).GetConstantBooleanArray(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantBooleanArrayHandle(reader).GetConstantBooleanArray(reader).Value.ToArray(); case HandleType.ConstantCharArray: - return handle.ToConstantCharArrayHandle(reader).GetConstantCharArray(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantCharArrayHandle(reader).GetConstantCharArray(reader).Value.ToArray(); case HandleType.ConstantByteArray: - return handle.ToConstantByteArrayHandle(reader).GetConstantByteArray(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantByteArrayHandle(reader).GetConstantByteArray(reader).Value.ToArray(); case HandleType.ConstantSByteArray: - return handle.ToConstantSByteArrayHandle(reader).GetConstantSByteArray(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantSByteArrayHandle(reader).GetConstantSByteArray(reader).Value.ToArray(); case HandleType.ConstantInt16Array: - return handle.ToConstantInt16ArrayHandle(reader).GetConstantInt16Array(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantInt16ArrayHandle(reader).GetConstantInt16Array(reader).Value.ToArray(); case HandleType.ConstantUInt16Array: - return handle.ToConstantUInt16ArrayHandle(reader).GetConstantUInt16Array(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantUInt16ArrayHandle(reader).GetConstantUInt16Array(reader).Value.ToArray(); case HandleType.ConstantInt32Array: - return handle.ToConstantInt32ArrayHandle(reader).GetConstantInt32Array(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantInt32ArrayHandle(reader).GetConstantInt32Array(reader).Value.ToArray(); case HandleType.ConstantUInt32Array: - return handle.ToConstantUInt32ArrayHandle(reader).GetConstantUInt32Array(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantUInt32ArrayHandle(reader).GetConstantUInt32Array(reader).Value.ToArray(); case HandleType.ConstantInt64Array: - return handle.ToConstantInt64ArrayHandle(reader).GetConstantInt64Array(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantInt64ArrayHandle(reader).GetConstantInt64Array(reader).Value.ToArray(); case HandleType.ConstantUInt64Array: - return handle.ToConstantUInt64ArrayHandle(reader).GetConstantUInt64Array(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantUInt64ArrayHandle(reader).GetConstantUInt64Array(reader).Value.ToArray(); case HandleType.ConstantSingleArray: - return handle.ToConstantSingleArrayHandle(reader).GetConstantSingleArray(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantSingleArrayHandle(reader).GetConstantSingleArray(reader).Value.ToArray(); case HandleType.ConstantDoubleArray: - return handle.ToConstantDoubleArrayHandle(reader).GetConstantDoubleArray(reader).Value.ReadOnlyCollectionToArray(); + return handle.ToConstantDoubleArrayHandle(reader).GetConstantDoubleArray(reader).Value.ToArray(); case HandleType.ConstantEnumArray: return TryParseConstantEnumArray(handle.ToConstantEnumArrayHandle(reader), reader, out exception); case HandleType.ConstantStringArray: { - Handle[] constantHandles = handle.ToConstantStringArrayHandle(reader).GetConstantStringArray(reader).Value.ToArray(); - string[] elements = new string[constantHandles.Length]; - for (int i = 0; i < constantHandles.Length; i++) + HandleCollection constantHandles = handle.ToConstantStringArrayHandle(reader).GetConstantStringArray(reader).Value; + string[] elements = new string[constantHandles.Count]; + int i = 0; + foreach (Handle constantHandle in constantHandles) { object elementValue; - exception = constantHandles[i].TryParseConstantValue(reader, out elementValue); + exception = constantHandle.TryParseConstantValue(reader, out elementValue); if (exception != null) return null; elements[i] = (string)elementValue; + i++; } return elements; } case HandleType.ConstantHandleArray: { - Handle[] constantHandles = handle.ToConstantHandleArrayHandle(reader).GetConstantHandleArray(reader).Value.ToArray(); - object[] elements = new object[constantHandles.Length]; - for (int i = 0; i < constantHandles.Length; i++) + HandleCollection constantHandles = handle.ToConstantHandleArrayHandle(reader).GetConstantHandleArray(reader).Value; + object[] elements = new object[constantHandles.Count]; + int i = 0; + foreach (Handle constantHandle in constantHandles) { - exception = constantHandles[i].TryParseConstantValue(reader, out elements[i]); + exception = constantHandle.TryParseConstantValue(reader, out elements[i]); if (exception != null) return null; + i++; } return elements; } @@ -469,28 +473,28 @@ namespace System.Reflection.Runtime.General switch (enumArray.Value.HandleType) { case HandleType.ConstantByteArray: - return enumArray.Value.ToConstantByteArrayHandle(reader).GetConstantByteArray(reader).Value.ReadOnlyCollectionToEnumArray(elementType); + return enumArray.Value.ToConstantByteArrayHandle(reader).GetConstantByteArray(reader).Value.ToArray(elementType); case HandleType.ConstantSByteArray: - return enumArray.Value.ToConstantSByteArrayHandle(reader).GetConstantSByteArray(reader).Value.ReadOnlyCollectionToEnumArray(elementType); + return enumArray.Value.ToConstantSByteArrayHandle(reader).GetConstantSByteArray(reader).Value.ToArray(elementType); case HandleType.ConstantInt16Array: - return enumArray.Value.ToConstantInt16ArrayHandle(reader).GetConstantInt16Array(reader).Value.ReadOnlyCollectionToEnumArray(elementType); + return enumArray.Value.ToConstantInt16ArrayHandle(reader).GetConstantInt16Array(reader).Value.ToArray(elementType); case HandleType.ConstantUInt16Array: - return enumArray.Value.ToConstantUInt16ArrayHandle(reader).GetConstantUInt16Array(reader).Value.ReadOnlyCollectionToEnumArray(elementType); + return enumArray.Value.ToConstantUInt16ArrayHandle(reader).GetConstantUInt16Array(reader).Value.ToArray(elementType); case HandleType.ConstantInt32Array: - return enumArray.Value.ToConstantInt32ArrayHandle(reader).GetConstantInt32Array(reader).Value.ReadOnlyCollectionToEnumArray(elementType); + return enumArray.Value.ToConstantInt32ArrayHandle(reader).GetConstantInt32Array(reader).Value.ToArray(elementType); case HandleType.ConstantUInt32Array: - return enumArray.Value.ToConstantUInt32ArrayHandle(reader).GetConstantUInt32Array(reader).Value.ReadOnlyCollectionToEnumArray(elementType); + return enumArray.Value.ToConstantUInt32ArrayHandle(reader).GetConstantUInt32Array(reader).Value.ToArray(elementType); case HandleType.ConstantInt64Array: - return enumArray.Value.ToConstantInt64ArrayHandle(reader).GetConstantInt64Array(reader).Value.ReadOnlyCollectionToEnumArray(elementType); + return enumArray.Value.ToConstantInt64ArrayHandle(reader).GetConstantInt64Array(reader).Value.ToArray(elementType); case HandleType.ConstantUInt64Array: - return enumArray.Value.ToConstantUInt64ArrayHandle(reader).GetConstantUInt64Array(reader).Value.ReadOnlyCollectionToEnumArray(elementType); + return enumArray.Value.ToConstantUInt64ArrayHandle(reader).GetConstantUInt64Array(reader).Value.ToArray(elementType); default: throw new BadImageFormatException(); @@ -609,7 +613,7 @@ namespace System.Reflection.Runtime.General yield return namespaceHandle; NamespaceDefinition namespaceDefinition = namespaceHandle.GetNamespaceDefinition(reader); - foreach (NamespaceDefinitionHandle childNamespaceHandle in GetTransitiveNamespaces(reader, namespaceDefinition.NamespaceDefinitions)) + foreach (NamespaceDefinitionHandle childNamespaceHandle in GetTransitiveNamespaces(reader, namespaceDefinition.NamespaceDefinitions.AsEnumerable())) yield return childNamespaceHandle; } } @@ -641,7 +645,7 @@ namespace System.Reflection.Runtime.General yield return typeDefinitionHandle; - foreach (TypeDefinitionHandle nestedTypeDefinitionHandle in GetTransitiveTypes(reader, typeDefinition.NestedTypes, publicOnly)) + foreach (TypeDefinitionHandle nestedTypeDefinitionHandle in GetTransitiveTypes(reader, typeDefinition.NestedTypes.AsEnumerable(), publicOnly)) yield return nestedTypeDefinitionHandle; } } @@ -683,6 +687,259 @@ namespace System.Reflection.Runtime.General fullName.Append(typeName); return fullName.ToString(); } + + public static IEnumerable<NamespaceDefinitionHandle> AsEnumerable(this NamespaceDefinitionHandleCollection collection) + { + foreach (NamespaceDefinitionHandle handle in collection) + yield return handle; + } + + public static IEnumerable<TypeDefinitionHandle> AsEnumerable(this TypeDefinitionHandleCollection collection) + { + foreach (TypeDefinitionHandle handle in collection) + yield return handle; + } + + public static Handle[] ToArray(this HandleCollection collection) + { + int count = collection.Count; + Handle[] result = new Handle[count]; + int i = 0; + foreach (Handle element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static bool[] ToArray(this BooleanCollection collection) + { + int count = collection.Count; + bool[] result = new bool[count]; + int i = 0; + foreach (bool element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static char[] ToArray(this CharCollection collection) + { + int count = collection.Count; + char[] result = new char[count]; + int i = 0; + foreach (char element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static float[] ToArray(this SingleCollection collection) + { + int count = collection.Count; + float[] result = new float[count]; + int i = 0; + foreach (float element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static double[] ToArray(this DoubleCollection collection) + { + int count = collection.Count; + double[] result = new double[count]; + int i = 0; + foreach (double element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static byte[] ToArray(this ByteCollection collection, Type enumType = null) + { + int count = collection.Count; + byte[] result; + if (enumType != null) + { + Debug.Assert(enumType.IsEnum); + result = (byte[])Array.CreateInstance(enumType, count); + } + else + { + result = new byte[count]; + } + int i = 0; + foreach (byte element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static sbyte[] ToArray(this SByteCollection collection, Type enumType = null) + { + int count = collection.Count; + sbyte[] result; + if (enumType != null) + { + Debug.Assert(enumType.IsEnum); + result = (sbyte[])Array.CreateInstance(enumType, count); + } + else + { + result = new sbyte[count]; + } + int i = 0; + foreach (sbyte element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static ushort[] ToArray(this UInt16Collection collection, Type enumType = null) + { + int count = collection.Count; + ushort[] result; + if (enumType != null) + { + Debug.Assert(enumType.IsEnum); + result = (ushort[])Array.CreateInstance(enumType, count); + } + else + { + result = new ushort[count]; + } + int i = 0; + foreach (ushort element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static short[] ToArray(this Int16Collection collection, Type enumType = null) + { + int count = collection.Count; + short[] result; + if (enumType != null) + { + Debug.Assert(enumType.IsEnum); + result = (short[])Array.CreateInstance(enumType, count); + } + else + { + result = new short[count]; + } + int i = 0; + foreach (short element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static uint[] ToArray(this UInt32Collection collection, Type enumType = null) + { + int count = collection.Count; + uint[] result; + if (enumType != null) + { + Debug.Assert(enumType.IsEnum); + result = (uint[])Array.CreateInstance(enumType, count); + } + else + { + result = new uint[count]; + } + int i = 0; + foreach (uint element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static int[] ToArray(this Int32Collection collection, Type enumType = null) + { + int count = collection.Count; + int[] result; + if (enumType != null) + { + Debug.Assert(enumType.IsEnum); + result = (int[])Array.CreateInstance(enumType, count); + } + else + { + result = new int[count]; + } + int i = 0; + foreach (int element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static ulong[] ToArray(this UInt64Collection collection, Type enumType = null) + { + int count = collection.Count; + ulong[] result; + if (enumType != null) + { + Debug.Assert(enumType.IsEnum); + result = (ulong[])Array.CreateInstance(enumType, count); + } + else + { + result = new ulong[count]; + } + int i = 0; + foreach (ulong element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } + + public static long[] ToArray(this Int64Collection collection, Type enumType = null) + { + int count = collection.Count; + long[] result; + if (enumType != null) + { + Debug.Assert(enumType.IsEnum); + result = (long[])Array.CreateInstance(enumType, count); + } + else + { + result = new long[count]; + } + int i = 0; + foreach (long element in collection) + { + result[i++] = element; + } + Debug.Assert(i == count); + return result; + } } } diff --git a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/Modules/NativeFormat/NativeFormatRuntimeModule.cs b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/Modules/NativeFormat/NativeFormatRuntimeModule.cs index b646ce7bc..e006776df 100644 --- a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/Modules/NativeFormat/NativeFormatRuntimeModule.cs +++ b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/Modules/NativeFormat/NativeFormatRuntimeModule.cs @@ -58,7 +58,7 @@ namespace System.Reflection.Runtime.Modules.NativeFormat { get { - byte[] mvid = _assembly.Scope.ScopeDefinition.Mvid.ReadOnlyCollectionToArray(); + byte[] mvid = _assembly.Scope.ScopeDefinition.Mvid.ToArray(); if (mvid.Length == 0) return default(Guid); // Workaround for TFS 441076 - Module data not emitted for facade assemblies. return new Guid(mvid); diff --git a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/NativeFormat/NativeFormatRuntimeNamedTypeInfo.cs b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/NativeFormat/NativeFormatRuntimeNamedTypeInfo.cs index 787e9370d..cf057083f 100644 --- a/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/NativeFormat/NativeFormatRuntimeNamedTypeInfo.cs +++ b/src/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/NativeFormat/NativeFormatRuntimeNamedTypeInfo.cs @@ -79,7 +79,7 @@ namespace System.Reflection.Runtime.TypeInfos.NativeFormat if (cah.IsCustomAttributeOfType(_reader, "System.Runtime.InteropServices", "GuidAttribute")) { CustomAttribute ca = cah.GetCustomAttribute(_reader); - IEnumerator<FixedArgumentHandle> fahEnumerator = ca.FixedArguments.GetEnumerator(); + FixedArgumentHandleCollection.Enumerator fahEnumerator = ca.FixedArguments.GetEnumerator(); if (!fahEnumerator.MoveNext()) continue; FixedArgumentHandle guidStringArgumentHandle = fahEnumerator.Current; |