Metalama 1.0 / / Metalama Documentation / Post­Sharp API Migration / Post­Sharp.​Extensibility

Namespace PostSharp.Extensibility

Classes

AllowFreeInstancesAttribute

No equivalent in Metalama.

AssemblyIdAttribute

No equivalent in Metalama.

BindingContext

No equivalent in Metalama.

DebuggerInterop

No equivalent in Metalama.

EscalatePostSharpMessageAttribute

To escalate Metalama warnings into errors, use the same strategy as for C# or analyzer errors.

HasInheritedAttributeAttribute

No equivalent in Metalama.

ImplementationBoundAttributeAttribute

There is no equivalent in Metalama. This logic is currently hard-coded.

InvalidAnnotationException

No equivalent in Metalama.

Message

In Metalama, a message is represented by a IDiagnostic. To instantiate a diagnostic, you must first declare its DiagnosticDefinition<T> as a static field or property, then use WithArguments(T).

MessageDispenser

In Metalama, messages are called diagnostics and they must be defined as static fields of aspects or fabrics using the DiagnosticDefinition<T> class.

MessageException

No equivalent in Metalama.

MessageLocation

In Metalama, the equivalent is IDiagnosticLocation.

MessageSource

No equivalent in Metalama.

MetricAttribute

No equivalent in Metalama.

MulticastAttribute

Okay, this one is problematic. There is no declarative (attribute-based) multicasting in Metalama. Instead, fabrics should be used. However, we have ported the main features of MulticastAttribute to Metalama. See MulticastAspect or MulticastImplementation.

MulticastAttributes

See the remarks on MulticastAttribute.

MulticastAttributeUsageAttribute

There is no full equivalent of this attribute in Metalama, and there will not be. To mark an aspect as inherited, use the InheritedAttribute custom attribute. To specify the eligibility of an aspect, implement the BuildEligibility(IEligibilityBuilder<T>) method.

MulticastInheritance

In Metalama, use the InheritedAttribute custom attribute to enable aspect inheritance. By default, Metalama implements the Strict inheritance mode. If you need multicasting, see MulticastAspect or MulticastImplementation.

MulticastTargets

In Metalama, the valid targets are determined by the declaration types for which the IAspect<T> interface is implemented. Additionally, you can implement the BuildEligibility(IEligibilityBuilder<T>) method. However, the main features of MulticastAttribute have been ported to Metalama. The equivalent to this attribute is MulticastTargets.

PostSharpEnvironment

In Metalama, use MetalamaExecutionContext.

ProjectExtensionElement

In Metalama, use ProjectExtension. However, all project extensions are programmatic. Metalama does not support XML configuration.

RequirePostSharpAttribute

In Metalama, use RequireAspectWeaverAttribute.

SeverityType

SuppressAnnotationValidationAttribute

There is no equivalent in Metalama.

SuppressWarningAttribute

In Metalama, use the same mechanism as for suppressing C# or analyzer warnings.

Interfaces

ICompatibilityLevelService

No equivalent in Metalama.

IFormattingService

In Metalama, use MetalamaExecutionContext.Current.FormatProvider.

IMessageDispenser

In Metalama, messages are called diagnostics and they must be defined as static fields of aspects or fabrics using the DiagnosticDefinition<T> class.

IMessageLocationResolver

In Metalama, an IDeclaration is also a IDiagnosticLocation.

IMessageSink

In Metalama, the equivalent is IDiagnosticSink.

IPostSharpEnvironment

In Metalama, use MetalamaExecutionContext.

IProject

In Metalama, use IProject.

IReflectionBindingManagerService

No equivalent in Metalama.

IService

In Metalama, use .

IServiceLocator

In Metalama, use IServiceProvider.

IStateStore

No equivalent in Metalama.

IValidableAnnotation

In Metalama, use IAspect<T> and implement BuildEligibility(IEligibilityBuilder<T>) and/or BuildAspect(IAspectBuilder<T>).

IWeavingSymbolsService

No equivalent in Metalama.