The low-level aspect weaver.

Classes

  Class Description
JoinPoint
A join point is a location in the code tree.
RestructureMethodBodyResult
Weaver
Weaves advices with main source code.
WeaverTask
Pluggable task that executes the PostSharp.CodeWeaver.
WeavingContext
Context of the current join point.
WeavingHelper
Provides methods that generate frequently used snippets of IL instructions.

Interfaces

  Interface Description
IAdvice
An advice is a class that is able to produce some MSIL code.
IAdviceProvider
Pluggable tasks (Task) should implement this interface when they want to provide advices (IAdvice) to the WeaverTask.
IBeforeStaticConstructorAdvice
Interface optionally implemented by advices on join points BeforeStaticConstructor, allowing to specify if the BeforeFieldInit class-level specifier is supported by this advice. An advice should return true if it only initializes static fields. The default, if the interface is not specified, is that this specifier is not specified.
ITypedExceptionAdvice
Exposes a method that allows advices of join points AfterMethodBodyException to specify which exceptions should be caught.

Enumerations

  Enumeration Description
ConstructorType
Determines whether the instance constructor calls a constructor its own class (this) or in the base class (base).
JoinPointKinds
Kinds of join points.
JoinPointPosition
Position of point points w.r.t. locations.
RestructureMethodBodyOptions

Remarks

The Code Weaver is a set of classes that interact to make it easy to inject instructions in the body of an existing method. It follows the concepts of Aspect-Oriented Programming (AOP). A JoinPoint is a location in the method body. An advice (which implements [PostSharp.CodeWeaver.IAdvice] is the piece of code that injects instructions. The Weaver class locates join points, orchestrates advices and restructures the method body.

The code weaver is typically included in the PostSharp build process. It is implemented as a task (WeaverTask). Other tasks may provide advices to the code weaver: they have to implement the IAdviceProvider interface.

Additionally, this namespace contains the class WeavingHelper, which provides methods that are frequently used during code weaving and may be used independently from other classes of this namespace.