Megosztás a következőn keresztül:


PortableExecutableReference.GetMetadataImpl Method

Definition

Get metadata representation for the PE file.

protected:
 abstract Microsoft::CodeAnalysis::Metadata ^ GetMetadataImpl();
protected abstract Microsoft.CodeAnalysis.Metadata GetMetadataImpl ();
abstract member GetMetadataImpl : unit -> Microsoft.CodeAnalysis.Metadata
Protected MustOverride Function GetMetadataImpl () As Metadata

Returns

Exceptions

If the PE image format is invalid.

The metadata image content can't be read.

The metadata image is stored in a file that can't be found.

Remarks

Called when the Compilation needs to read the reference metadata.

The listed exceptions are caught and converted to compilation diagnostics. Any other exception is considered an unexpected error in the implementation and is not caught.

Metadata objects may cache information decoded from the PE image. Reusing Metadata instances across metadata references will result in better performance.

The calling Compilation doesn't take ownership of the Metadata objects returned by this method. The implementation needs to retrieve the object from a provider that manages their lifetime (such as metadata cache). The Metadata object is kept alive by the Compilation that called Microsoft.CodeAnalysis.PortableExecutableReference.GetMetadataNoCopy and by all compilations created from it via calls to With- factory methods on Compilation, other than WithReferences(MetadataReference[]) overloads. A compilation created using WithReferences(MetadataReference[]) will call to Microsoft.CodeAnalysis.PortableExecutableReference.GetMetadataNoCopy again.

Applies to