Open sandboxFocus

Class AsyncCallIdAttribute

Binds a parameter of a method boundary advice to the AsyncCallId that identifies the current execution of an async method.

Inheritance
AsyncCallIdAttribute
Namespace: PostSharp.Aspects.Advices
Assembly: PostSharp.dll
Syntax
public sealed class AsyncCallIdAttribute : AdviceParameterAttribute
Remarks

All the advices of one execution of the async method receive the same value, so the identifier can correlate the events of this execution, for instance in a log. The parameter must be of type AsyncCallId, and it cannot be ref, in or out.

This attribute can be used in the method boundary advices. When the target method is not transformed as an async method, for instance when it is an iterator, the parameter receives the default value of AsyncCallId, unless IsRequired is true.

Constructors

Name Description
AsyncCallIdAttribute()

Properties

Name Description
IsRequired

Gets or sets a value indicating whether the target must be an async method. When this property is true, the compiler reports an error when the target method is not transformed as an async method. When it is false, the parameter receives the default value of AsyncCallId. The default value is false.

See Also