Skip to content
Concord

Class ControlHandle

Namespace
Concord
Assembly
Concord.Emit.dll

Control parameter passed to void-target injections that need to cancel target execution.

public sealed class ControlHandle
Inheritance
ControlHandle
Inherited Members

Remarks

Concord lowers calls on this type into wrapper locals while composing IL. Runtime instances are not allocated on the patched method hot path.

Methods

Cancel()

Marks the current injection as cancelling the original target invocation.

[SuppressMessage("Performance", "CA1822", Justification = "Lowering matches Call/Callvirt on a ControlHandle instance; making this static would change the emitted call shape and stop ControlHandleLowering from recognising the site.")]
public void Cancel()

GetState<T>()

Reads the value stored in this call's state slot, or the type default when nothing wrote it.

[SuppressMessage("Performance", "CA1822", Justification = "Lowering matches Call/Callvirt on a ControlHandle instance; making this static would change the emitted call shape and stop ControlHandleLowering from recognising the site.")]
public T GetState<T>()

Returns

T

The stored value.

Type Parameters

T

The slot's type. Every injection in one declaration must agree on it.

SetState<T>(T)

Stores a value in this call's state slot. The slot is scoped to the declaring patch declaration and lives for one target call.

[SuppressMessage("Performance", "CA1822", Justification = "Lowering matches Call/Callvirt on a ControlHandle instance; making this static would change the emitted call shape and stop ControlHandleLowering from recognising the site.")]
public void SetState<T>(T value)

Parameters

value T

The value to store.

Type Parameters

T

The slot's type. Every injection in one declaration must agree on it.