Metalama//API Documentation/Introspection API/Metalama.​Framework.​Introspection
Open sandboxFocus

Namespace Metalama.Framework.Introspection

Overview

This namespace exposes some intermediate details of the compilation process, such as the list of aspect classes, aspect instances, advice, transformations, or diagnostics.

This namespace is helpful when you want to troubleshoot an aspect, a fabric, or a set of aspects. It gives you details that are not obvious from the compilation output.

To start with this namespace, you should load your C# project or solution using the Metalama.Framework.Workspaces namespace or with the LINQPad driver. See Inspecting a project using LINQPad for details.

The entry point of this namespace is the IIntrospectionCompilationDetails interface. This interface is implemented by the Workspace and Project classes.

For instance, the following query returns all aspect instances in a project:

workspace.GetProject("Metalama.Samples.Log4", "net6.0").AspectInstances

Class diagram

classDiagram IIntrospectionCompilationDetails --* "0..*" IIntrospectionDiagnostic IIntrospectionCompilationDetails --* "0..*" IIntrospectionAspectClass IIntrospectionCompilationDetails --* "0..*" IIntrospectionAspectLayer IIntrospectionCompilationDetails --* "0..*" IIntrospectionAspectInstance IIntrospectionCompilationDetails --* "0..*" IIntrospectionAdvice IIntrospectionCompilationDetails --* "0..*" IIntrospectionTransformation IIntrospectionAspectClass "1" --* "0..*" IIntrospectionAspectInstance IIntrospectionAspectClass "1" --o "1..*" IIntrospectionAspectLayer IIntrospectionAspectInstance --* "0..*" IIntrospectionDiagnostic IIntrospectionAspectInstance --o "0..*" IIntrospectionAdvice IIntrospectionAspectInstance --* "0..*" IIntrospectionAspectInstance : SecondaryInstances IIntrospectionAspectInstance --|> IIntrospectionAspectPredecessor IIntrospectionFabric --|> IIntrospectionAspectPredecessor IIntrospectionAttributeAsPredecessor --|> IIntrospectionAspectPredecessor class IIntrospectionAspectInstance { Aspect: IAspect AspectState: IAspectState } class IIntrospectionAspectLayer { Id LayerName Order ExplicitOrder IsDefaultLayer } class IIntrospectionAspectPredecessor { PredecessorDegree TargetDeclaration : IDeclaration } class IIntrospectionAdvice { AdviceKind TargetDeclaration AspectLayerId } class IIntrospectionTransformation { TransformationKind TargetDeclaration Description IntroducedDeclaration Order } IIntrospectionAdvice "1" --* "0..*" IIntrospectionTransformation : Transformation IIntrospectionAspectPredecessor "0..*" --* "0..*" IIntrospectionAspectPredecessor : Predecessors IIntrospectionAspectPredecessor "0..*" --* "0..*" IIntrospectionAspectPredecessor : Successors

Classes

CompilationFailedException

Exception thrown when the compilation failed.

DiagnosticSource

Enumerates the possible sources (or originators) of an IIntrospectionDiagnostic.

IntrospectionAspectRelationship

Represents the relationship that an object (attribute, fabric, aspect) has created or required another aspect or validator. These relationships are exposed on Predecessors and Successors.

IntrospectionOptions

TransformationKind

Interfaces

IIntrospectionAdvice

Represents a piece of advice provided by an aspect.

IIntrospectionAspectClass

Represents an aspect class (i.e. a type of aspect) and exposes all its instances in the current scope.

IIntrospectionAspectInstance

Represents an instance of an aspect, as well as the results of the aspect instance.

IIntrospectionAspectLayer

IIntrospectionAspectPredecessor

Base interface for objects that can cause aspects to be added to a compilation. Predecessors are exposed on the Predecessors property.

IIntrospectionAspectPredecessorInternal

IIntrospectionAttributeAsPredecessor

Wraps an IAttribute (which represents a custom attribute) into a IIntrospectionAspectPredecessor.

IIntrospectionCompilationDetails

Exposes the compilation results but not the transformed source code.

IIntrospectionCompilationResult

Represents the result of the processing of a compilation by Metalama.

IIntrospectionDiagnostic

Represents a diagnostic (error, warning, information, hidden message).

IIntrospectionFabric

Represents a fabric.

IIntrospectionTransformation

Represents a code transformation.