Open sandboxFocus

Class OnExceptionAspect

In Metalama, use OverrideMethodAspect and write your own try/catch block.

Namespace: PostSharp.Aspects
Assembly: Metalama.Migration.dll
Syntax
[AttributeUsage(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Event|AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
[MulticastAttributeUsage(MulticastTargets.Method|MulticastTargets.InstanceConstructor|MulticastTargets.StaticConstructor, TargetMemberAttributes = MulticastAttributes.AnyVisibility|MulticastAttributes.AnyScope|MulticastAttributes.NonAbstract|MulticastAttributes.Managed, AllowMultiple = true)]
[Obsolete("In Metalama, use 'OverrideMethodAspect' and write your own try/catch block.", false)]
public abstract class OnExceptionAspect : MethodLevelAspect, IMethodLevelAspectBuildSemantics, IAspectBuildSemantics, IValidableAnnotation, IOnExceptionAspect, IMethodLevelAspect, IAspect

Constructors

Name Description
OnExceptionAspect()

Properties

Name Description
SemanticallyAdvisedMethodKinds

In Metalama, implement different methods OverrideMethod(), OverrideAsyncMethod(), OverrideEnumerableMethod() or OverrideEnumeratorMethod(), and set the properties UseAsyncTemplateForAnyAwaitable or UseEnumerableTemplateForAnyEnumerable.

UnsupportedTargetAction

There is no equivalent in Metalama. Unsupported targets will throw an exception.

Methods

Name Description
CreateAspectConfiguration()

No equivalent in Metalama.

GetExceptionType(MethodBase)

There is no equivalent in Metalama because you write your own try/catch code in the template.

OnException(MethodExecutionArgs)

Implement OverrideMethod() and write your own try/catch block.

SetAspectConfiguration(AspectConfiguration, MethodBase)

Not supported in Metalama.