PostSharp6.4//API Reference/Post­Sharp.​Aspects Namespace/Method­Execution­Args Class/Method­Execution­Args Properties/Method­Execution­Args.​Exception Property

MethodExecutionArgs.Exception Property

Gets or sets the exception thrown by the target method.

Namespace:  PostSharp.Aspects
Assembly:  PostSharp (in PostSharp.dll) Version: 6.4.11.0 (6.4.11.0)
Syntax
C#
public Exception Exception { get; set; }

Property Value

Type: Exception
An Exception, or null if the method is exiting normally.
Remarks

This property is only available inside the OnException(MethodExecutionArgs) and OnException(MethodExecutionArgs) advices.

You can replace the exception by setting this property and also setting FlowBehavior to ThrowException. You can also throw a new exception from the advice if you need to replace the current exception.

See Also