Freigeben über


IMaintenanceTask.PerformMaintenanceAsync(CancellationToken) Method

Definition

Invoked by the idle manager when it's a good time to get your periodic maintenance task done.

public System.Threading.Tasks.Task PerformMaintenanceAsync (System.Threading.CancellationToken cancellationToken);
abstract member PerformMaintenanceAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function PerformMaintenanceAsync (cancellationToken As CancellationToken) As Task

Parameters

cancellationToken
CancellationToken

A token that is canceled when the user begins interacting with the IDE again.

Returns

A task that tracks the potentially asynchronous background operation.

Exceptions

May be thrown when cancellationToken is canceled in order to be called again the next time the IDE is idle.

Any other exception thrown by an implementation gets logged to the VS Activity Log and posted as fault telemetry.

Remarks

This method will be invoked on a background thread. Attempts to switch to the main thread with SwitchToMainThreadAsync(CancellationToken) will be processed with background priority.

This method runs at most once per session (during a long idle period), or more than once when prior runs were canceled due to user activity.

Applies to