Open sandboxFocus

Class Workspace

Represents a set of projects. Workspaces can be created using the WorkspaceCollection class. When projects target several frameworks, they are represented by several instances of the Project class in the workspace.

Inheritance
Workspace
Namespace: Metalama.Framework.Workspaces
Assembly: Metalama.Framework.Workspaces.dll
Syntax
public sealed class Workspace : IDisposable, IProjectSet, ICompilationSetResult, IIntrospectionCompilationDetails, IWorkspaceLoadInfo

Properties

Name Description
Advice

Gets the list of advice in the compilation.

AspectClasses

Gets the list of aspect classes in the compilation.

AspectInstances

Gets the list of aspect instances in the compilation.

AspectLayers

Gets the ordered list of aspect layers in the compilation. Note that when the current object represents several projects, the execution order of the aspect layers is not relevant.

Diagnostics

Gets the list of diagnostics reported by Metalama and by aspects.

HasMetalamaSucceeded

Gets a value indicating whether the processing of the compilation by Metalama was successful for all projects in the current set. This property returns true if the Metalama compilation process completed successfully, even if it resulted the compilation processes reported errors. These errors would be visible in the Diagnostics collection.

IntrospectionOptions

Gets the IntrospectionOptions for the current workspace.

IsMetalamaEnabled

Gets a value indicating whether Metalama is enabled on this project.

LoadedPaths
MetalamaVersion

Gets the version number of Metalama. This is determined by the LinqPad packages for Metalama, not by the Metalama packages in the projects loaded in the workspace.

Projects

Gets the projects in the current ProjectSet.

Properties
SourceCode
Transformations

Gets the list of transformations applied to source code.

TransformedCode
WorkspaceDiagnostics

Methods

Name Description
ApplyFilter(Predicate<Project>)

Filters the Projects collection with a given predicate. This allows to filter the output of methods such as GetInboundReferences(IDeclaration, IntrospectionChildKinds, CancellationToken) or GetDerivedTypes(INamedType, bool) to the filtered subset.

ClearFilters()

Clear all filters applied by ApplyFilter(Predicate<Project>).

Dispose()
GetDeclaration(string, string, string, bool)

Gets a declaration in the current subset.

GetProject(string, string?)
GetSubset(Predicate<Project>)

Returns a subset of the current subset.

Load(params string[])

Loads a set of projects of solutions into a Workspace, or returns an existing workspace if the method has been previously called with the exact same parameters. This method creates the workspace in the default WorkspaceCollection.

LoadAsync(params string[])

Asynchronously loads a set of projects of solutions into a Workspace, or returns an existing workspace if the method has been previously called with the exact same parameters. This method creates the workspace in the default WorkspaceCollection.

Reload(bool, CancellationToken)
ReloadAsync(bool, CancellationToken)

Reloads all projects in the current workspace.

WithIgnoreErrors()

Modifies the IntrospectionOptions of the current workspace by setting the IgnoreErrors property to true.

WithIntrospectionOptions(IntrospectionOptions)

Modifies the IntrospectionOptions of the current workspace, and returns the current workspace.

Events

Name Description
Disposed

Extension Methods