src/Microsoft/Windows/ComponentObjectModel/IO/_Library/Metadata/ComponentLibraryMetadataReader.cs
/// <summary>
/// Iterates <see cref="TypeDefinition"/> instances of the given <see cref="MetadataReader"/> instance.
/// It invokes inspection and conversion of TypeDefinition instances to <see cref="ComponentRegistrationInformation"/> instances and adds them to the given <see cref="ComponentLibraryMetadata"/> instance.
/// </summary>
/// <param name="reader">The <see cref="MetadataReader"/> instance to read from.</param>
/// <param name="libraryMetadata">The <see cref="ComponentLibraryMetadata"/> instance to add <see cref="ComponentRegistrationInformation"/> instances to.</param>
Iterates  instances of the given  instance.
It invokes inspection and conversion of TypeDefinition instances to  instances and adds them to the given  instance.
Iterates instances of the given instance . It invokes inspection and conversion of TypeDefinition instances to instances and adds them to the given instance .
protected virtual void ReadTypes( MetadataReader reader, ComponentLibraryMetadata libraryMetadata ) {
            bool libraryIsComVisible = libraryMetadata.Attributes.Get<ComVisibleAttribute>()?.Value ?? false;
            foreach ( TypeDefinitionHandle typeDefinitionHandle in reader.TypeDefinitions ) {
                TypeDefinition typeDefinition = reader.GetTypeDefinition( typeDefinitionHandle );
                string typeName               = reader.GetString( typeDefinition.Name );
                if ( typeName == "<Module>" && typeDefinition.Namespace.IsNil ) {
                    continue;
                }
                if ( !TypeImplementsComponentRequirements( reader, typeDefinition ) ) {
                    continue;
                }
                ComponentAttributeCollection customAttributes = ReadCustomAttributes(reader, typeDefinition.GetCustomAttributes(), HandleKind.TypeDefinition);
                bool typeIsComVisible = customAttributes.Get<ComVisibleAttribute>()?.Value ?? false;
                if ( !typeIsComVisible ) {
                    if ( libraryMetadata.AssemblyTargetFramework == ComponentLibraryTargetFramework.DotNetCore ) {
                        continue;
                    }
                    if ( libraryMetadata.AssemblyTargetFramework == ComponentLibraryTargetFramework.DotNetFramework ) {
                        if ( !libraryIsComVisible ) {
                            continue;
                        }
                    }
                }
                ComponentRegistrationInformation componentInformation = ReadComponentInformation(reader, typeDefinition, customAttributes, libraryMetadata);
                if ( null == componentInformation ) {
                    continue;
                }
                libraryMetadata.Components.Add( componentInformation );
            }
        }
protected virtual void ReadTypes ( MetadataReader reader , ComponentLibraryMetadata libraryMetadata ) { bool libraryIsComVisible = libraryMetadata . Attributes . Get < ComVisibleAttribute > ( ) ? . Value ?? false ; foreach ( TypeDefinitionHandle typeDefinitionHandle in reader . TypeDefinitions ) { TypeDefinition typeDefinition = reader . GetTypeDefinition ( typeDefinitionHandle ) ; string typeName = reader . GetString ( typeDefinition . Name ) ; if ( typeName == " " && typeDefinition . Namespace . IsNil ) { continue ; } if ( ! TypeImplementsComponentRequirements ( reader , typeDefinition ) ) { continue ; } ComponentAttributeCollection customAttributes = ReadCustomAttributes ( reader , typeDefinition . GetCustomAttributes ( ) , HandleKind . TypeDefinition ) ; bool typeIsComVisible = customAttributes . Get < ComVisibleAttribute > ( ) ? . Value ?? false ; if ( ! typeIsComVisible ) { if ( libraryMetadata . AssemblyTargetFramework == ComponentLibraryTargetFramework . DotNetCore ) { continue ; } if ( libraryMetadata . AssemblyTargetFramework == ComponentLibraryTargetFramework . DotNetFramework ) { if ( ! libraryIsComVisible ) { continue ; } } } ComponentRegistrationInformation componentInformation = ReadComponentInformation ( reader , typeDefinition , customAttributes , libraryMetadata ) ; if ( null == componentInformation ) { continue ; } libraryMetadata . Components . Add ( componentInformation ) ; } }
Iterates  instances of the given  instance.
Iterates instances of the given instance .
// Validate COM Visibility
reader
MetadataReader
The  instance to read from.
The instance to read from .
libraryMetadata
ComponentLibraryMetadata
The  instance to add  instances to.
The instance to add instances to .