MetalamaAPI documentationIntrospection APIMetalama.​Framework.​Introspection
Open sandboxFocusImprove this doc

Metalama.Framework.Introspection Namespace

Overview

This namespace reveals intermediate details of the compilation process, such as the list of aspect classes, aspect instances, advice, transformations, and diagnostics.

This namespace proves useful when troubleshooting an aspect, a fabric, or a set of aspects. It provides details that are not readily apparent from the compilation output.

To begin with this namespace, load your C# project or solution using the Metalama.Framework.Workspaces namespace or with the LINQPad driver. Refer to Inspecting a project using LINQPad for more information.

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

For example, 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.