Click or drag to resize
ThreadAgnosticAttribute Class
Marks the layout or layout renderer as producing correct results regardless of the thread it's running on.
Inheritance Hierarchy
SystemObject
  SystemAttribute
    NLog.ConfigThreadAgnosticAttribute

Namespace: NLog.Config
Assembly: NLog (in NLog.dll) Version: 4.3.0
Syntax
public sealed class ThreadAgnosticAttribute : Attribute

The ThreadAgnosticAttribute type exposes the following members.

Constructors
  NameDescription
Public methodThreadAgnosticAttribute
Initializes a new instance of the ThreadAgnosticAttribute class
Top
Remarks
This is important because some layout renders should use the main thread. E.g. for using HttpContext.Current etc. If set to true then a layout will be render in the main thread, so for example in the AsyncTargetWrapper and BufferTargetWrapper with the PrecalculateVolatileLayouts(LogEventInfo) , using Precalculate(LogEventInfo) Apply this attribute when: - The result can we rendered in another thread. Delaying this could be more efficient. And/Or, - The result should not be precalculated, for example the target sends some extra context information.
See Also