JoinableTaskContext.Capture Method

Definition

Captures the caller's context and serializes it as a string that is suitable for application via a subsequent call to RunAsync(Func<Task>, String, JoinableTaskCreationOptions).

public string? Capture ();
member this.Capture : unit -> string
Public Function Capture () As String

Returns

A string that represent the current context, or null if there is none.

Remarks

To optimize calling patterns, this method returns null even when inside a JoinableTask context when this JoinableTaskContext was initialized without a SynchronizationContext, which means no main thread exists and thus there is no need to capture and reapply tokens.

Applies to