Open sandboxFocus

Property CancellationToken

CancellationToken

Gets the cancellation token for the current operation. Use this to detect when the build process has been cancelled and abort long-running operations gracefully.

Declaration
CancellationToken CancellationToken { get; }
Property Value
Type Description
CancellationToken
Remarks

Cancellation can occur during user-initiated build cancellations or at design time when Metalama detects source code changes in the editor (e.g., the user is typing). To maintain IDE responsiveness, it is important that BuildAspect(IAspectBuilder<T>) executes quickly and checks for cancellation regularly.

Call ThrowIfCancellationRequested() periodically during expensive operations to respond to cancellation requests promptly.