Open sandboxFocusImprove this doc

Querying and analyzing code

Metalama provides powerful APIs for querying and analyzing your source code outside of aspects and fabrics. You can inspect declarations, dependencies, aspect outcomes, and code transformations either programmatically or interactively using LINQPad.

Article Description
Using the Workspaces API How to use the Workspaces API to query code programmatically from any .NET application.
Using LINQPad How to use the Metalama driver for LINQPad to interactively query and explore your codebase.
Consuming code metrics How to consume code metrics like statement counts and syntax node counts.

Benefits

The introspection APIs allow you to:

  • Query code using the same Metalama.Framework.Code API as aspects and fabrics.
  • List target declarations of aspects.
  • Inspect aspect outcomes: code transformations, diagnostics, and child aspects.
  • Query the transformed code after Metalama executes.
  • Analyze code dependencies and references.

See also