Open sandboxFocus

Class OnMethodInvokeBaseAdvice

The base class for method interception advices.

Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp.dll
Syntax
public abstract class OnMethodInvokeBaseAdvice : GroupingAdvice
Remarks

A method interception advice can be applied to an abstract method of the current assembly. PostSharp then gives the method an implementation that throws NotSupportedException, unless another aspect implements the method. The advice runs when the method is called, and gets the exception only when it proceeds to this implementation; an advice that does not proceed returns normally. The overrides of the method in derived classes are not intercepted. The compiler reports warning LA0254 in this case. To exclude abstract methods from a multicast aspect, set the AttributeTargetMemberAttributes property of the aspect, or the TargetMemberAttributes property of its MulticastAttributeUsageAttribute, to NonAbstract. An aspect provider (IAspectProvider) or a pointcut that selects methods must exclude abstract methods itself, because multicast filters do not apply to the targets it selects.

Constructors

Name Description
OnMethodInvokeBaseAdvice()

Properties

Name Description
SemanticallyAdvisedMethodKinds

Gets or sets which target methods are advised semantically. This affects the behavior of the advice when it is applied to iterator or async methods, which are compiled into state machines.

UnsupportedTargetAction

Gets or sets the action to take when the advice is applied to an async method with unsupported return value type.