BackgroundTaskCompletedEventArgs BackgroundTaskCompletedEventArgs BackgroundTaskCompletedEventArgs BackgroundTaskCompletedEventArgs BackgroundTaskCompletedEventArgs Class


Represents completion information for a task at the time a completion notification is sent.

public : sealed class BackgroundTaskCompletedEventArgs
struct winrt::Windows::ApplicationModel::Background::BackgroundTaskCompletedEventArgs
public sealed class BackgroundTaskCompletedEventArgs
Public NotInheritable Class BackgroundTaskCompletedEventArgs
// This class does not provide a public constructor.

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


The following example shows how to use the BackgroundTaskCompletedEventArgs class with a BackgroundTaskCompletedEventHandler delegate to monitor background task completion while the app is in the foreground. Note that this depends on the background task to report status via LocalSettings.

private async void OnCompleted(IBackgroundTaskRegistration task,
                               BackgroundTaskCompletedEventArgs args)
    var settings = ApplicationData.Current.LocalSettings;
    var key = task.TaskId.ToString();
    string status = settings.Values[key].ToString();

    // UI element updates should be done asynchronously.
    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
    () =>
        ExampleProgressElement.Text = "Task completed with status: " + status;


The system generates this class and passes it as an argument to the application's BackgroundTaskCompletedEventHandler handler.


InstanceId InstanceId InstanceId InstanceId InstanceId

Gets the identifier of the background task instance for this completion status notification.


CheckResult() CheckResult() CheckResult() CheckResult() CheckResult()

Throws an exception if the background task completed event has reported an error.