Open sandboxFocus

Enum FlowBehavior

Enumerates the possible behaviors of the calling method after the calling method has returned.

Namespace: PostSharp.Aspects
Assembly: PostSharp.dll
Syntax
public enum FlowBehavior
Remarks

An advice sets the flow behavior through the FlowBehavior property, or through a parameter bound by FlowBehaviorAttribute.

Fields

Name Description
Continue

Continues normal method execution. For OnException(MethodExecutionArgs) advice, the Continue behavior works the same way as the Return behavior.

Default

Default flow behavior for the current method. The default flow is Continue for all advices except for OnException(MethodExecutionArgs) where it is RethrowException.

RethrowException

The current exception will be rethrown. Available only for OnException(MethodExecutionArgs).

Return

Returns immediately from the current method. Available only for OnEntry(MethodExecutionArgs) and OnException(MethodExecutionArgs). You may want to set the ReturnValue property, or the parameter bound by ReturnValueAttribute. Otherwise, you may get a NullReferenceException. If there is another OnMethodBoundaryAspect aspect before the current OnMethodBoundaryAspect aspect on the current method, the Return behavior calls the OnSuccess(MethodExecutionArgs) and OnExit(MethodExecutionArgs) methods of the other aspect.

ThrowException

Throws the exception contained in the Exception property, or in the parameter bound by ExceptionAttribute. Available only for OnException(MethodExecutionArgs).

Yield

Awaits an awaiter. Available only for OnMethodEntryAdvice and OnMethodResumeAdvice advice methods applied to async methods. The advice must have a parameter bound by AwaiterAttribute, to which it assigns the awaiter, and a parameter bound by FlowBehaviorAttribute. The methods of OnMethodBoundaryAspect cannot use this behavior.