PostSharp 2023.0 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Patterns.​Diagnostics.​Contexts Namespace / Sync­Custom­Activity­Logging­Context Class / Sync­Custom­Activity­Logging­Context Methods / Sync­Custom­Activity­Logging­Context.​Get­Execution­Context­Data Method

SyncCustomActivityLoggingContext.GetExecutionContextData Method

Returns a new layer for the async stack that has this LoggingContext as the associated activity and current as the Parent, if a new layer is required.

Namespace:  PostSharp.Patterns.Diagnostics.Contexts
Assembly:  PostSharp.Patterns.Diagnostics (in PostSharp.Patterns.Diagnostics.dll) Version: 2023.0.3.0 (2023.0.3.0)
protected override LoggingExecutionContextData GetExecutionContextData(
	LoggingExecutionContextData current,
	bool requireNew


Type: PostSharp.Patterns.Diagnostics.Contexts.LoggingExecutionContextData
The layer in the async stack that's currently on top. It will become the parent of the new layer.
Type: System.Boolean
If true, then this method must return a new instance. This is a parameter passed by the overriding method to the base call if the overriding method wants the layer to be created even if there's no properties or synthetic ID.

Return Value

Type: LoggingExecutionContextData
The LoggingExecutionContextData to be put on top of the async stack, or null if the no new layer is needed.
The flow is:
  • LoggingContext.UpdateExecutionContextData calls LoggingContext.GetExecutionContextData, which is virtual
  • GetExecutionContextData returns null if no new layer needs to be created, or returns the new layer, fully edited, otherwise.
  • The implementation in the LoggingContext class creates a copy using "LoggingExecutionContextData.Clone" which may create a subclass.
  • Implementors must call the base class so that synthetic ID, logging properties and such stuff is filled in.
See Also