Table of Contents

Class CompositionConfiguration

Namespace
Microsoft.VisualStudio.Composition
Assembly
Microsoft.VisualStudio.Composition.dll
public class CompositionConfiguration
Inheritance
CompositionConfiguration
Inherited Members

Properties

Catalog

Gets the catalog that backs this configuration. This may be a smaller catalog than the one passed in to create this configuration if invalid parts were removed.

public ComposableCatalog Catalog { get; }

Property Value

ComposableCatalog

CompositionErrors

Gets the compositional errors detected while creating this configuration that led to the removal of parts from the catalog backing this configuration.

public IImmutableStack<IReadOnlyCollection<ComposedPartDiagnostic>> CompositionErrors { get; }

Property Value

IImmutableStack<IReadOnlyCollection<ComposedPartDiagnostic>>

Remarks

The errors are collected as a stack. The topmost stack element represents the first level of errors detected. As errors are detected and parts removed to achieve a 'stable composition', each cycle of removing parts and detecting additional errors gets a deeper element in the stack. Therefore the 'root cause' of all failures is generally found in the topmost stack element.

MetadataViewsAndProviders

Gets a map of metadata views and their matching providers.

public IReadOnlyDictionary<Type, ExportDefinitionBinding> MetadataViewsAndProviders { get; }

Property Value

IReadOnlyDictionary<Type, ExportDefinitionBinding>

Parts

Gets the composed parts, with exports satisfied, that make up this configuration.

public ISet<ComposedPart> Parts { get; }

Property Value

ISet<ComposedPart>

Methods

Create(ComposableCatalog)

public static CompositionConfiguration Create(ComposableCatalog catalog)

Parameters

catalog ComposableCatalog

Returns

CompositionConfiguration

CreateDgml()

public XDocument CreateDgml()

Returns

XDocument

CreateExportProviderFactory()

public IExportProviderFactory CreateExportProviderFactory()

Returns

IExportProviderFactory

GetEffectiveSharingBoundary(ComposablePartDefinition)

public string? GetEffectiveSharingBoundary(ComposablePartDefinition partDefinition)

Parameters

partDefinition ComposablePartDefinition

Returns

string

ThrowOnErrors()

Returns the configuration if it is valid, otherwise throws an exception describing any compositional failures.

public CompositionConfiguration ThrowOnErrors()

Returns

CompositionConfiguration

This configuration.

Remarks

This method returns this so that it may be used in a 'fluent API' expression.

Exceptions

CompositionFailedException

Thrown if CompositionErrors is non-empty.