CorrelationManager.StartLogicalOperation Method

Definition

Starts a logical operation on a thread.

Overloads

StartLogicalOperation()

Starts a logical operation on a thread.

StartLogicalOperation(Object)

Starts a logical operation with the specified identity on a thread.

StartLogicalOperation()

Source:
CorrelationManager.cs
Source:
CorrelationManager.cs
Source:
CorrelationManager.cs

Starts a logical operation on a thread.

C#
public void StartLogicalOperation();

Remarks

The logical operation is started using an automatically generated GUID for a logical operation identifier.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

StartLogicalOperation(Object)

Source:
CorrelationManager.cs
Source:
CorrelationManager.cs
Source:
CorrelationManager.cs

Starts a logical operation with the specified identity on a thread.

C#
public void StartLogicalOperation(object operationId);

Parameters

operationId
Object

An object identifying the operation.

Exceptions

The operationId parameter is null.

Examples

The following code example demonstrates the use of the StartLogicalOperation(Object) method by initializing a logical operation to be associated with the main thread. For the complete code example, see the CorrelationManager class.

C#
TraceSource ts = new TraceSource("MyApp");
int i = ts.Listeners.Add(new ConsoleTraceListener());
ts.Listeners[i].TraceOutputOptions = TraceOptions.LogicalOperationStack;
ts.Switch = new SourceSwitch("MyAPP", "Verbose");
// Start the logical operation on the Main thread.
Trace.CorrelationManager.StartLogicalOperation("MainThread");

Remarks

The operationId parameter can be any object, such as a String that allows the operation to be identified for tracing purposes. The object represented by operationId is added to the LogicalOperationStack property.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1