PostSharpAPI ReferencePost­Sharp.​AspectsMethod­Execution­ArgsException
Open sandboxFocus

MethodExecutionArgs.Exception Property

Exception

Gets or sets the exception thrown by the target method.

Declaration
public Exception Exception { get; set; }
Property Value
Type Description
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.