PostSharpAPI ReferencePost­Sharp.​AspectsOn­Exception­Aspect
Open sandboxFocus

Class OnExceptionAspect

Aspect that, when applied to a method, defines an exception handler around the whole method and calls a custom method in this exception handler.

Inheritance
OnExceptionAspect
Namespace: PostSharp.Aspects
Assembly: PostSharp.dll
Syntax
[MulticastAttributeUsage]
[HasInheritedAttribute]
[AspectConfigurationAttributeType]
[Serializer]
public abstract class OnExceptionAspect : MethodLevelAspect, IMethodLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, IOnExceptionAspect, IMethodLevelAspect, IAspect

Constructors

Name Description
OnExceptionAspect() PostSharp.Aspects.OnExceptionAspect

Properties

Name Description
SemanticallyAdvisedMethodKinds

Determines which target methods will be advised semantically. This affects the behavior of the aspect when it's applied to iterator or async methods, which are compiled into state machines.

UnsupportedTargetAction

Specifies the action to take when the aspect is applied to an unsupported target method.

Methods

Name Description
CreateAspectConfiguration()

Method invoked at build time to create a concrete AspectConfiguration instance specifically for the current Aspect type.

GetExceptionType(MethodBase)

Gets the type of exception handled by this aspect.

OnException(MethodExecutionArgs)

Method executed after the body of methods to which this aspect is applied, in case that the method failed with an exception (i.e., in a catch block).

SetAspectConfiguration(AspectConfiguration, MethodBase)

Method invoked at build time to set up an AspectConfiguration object according to the current Aspect instance and a specified target element of the current aspect.