AsyncCompletedEventArgs::Error Property

Gets a value that indicates which error occurred during an asynchronous operation.

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

No code example is currently available or this language may not be supported.

Property Value

Type: System::Exception
An Exception instance, if an error occurred during an asynchronous operation; otherwise nullptr.

If an exception is raised during an asynchronous operation, the class will assign the exception to the Error property. The client application's event-handler delegate should check the Error property before accessing any properties in a class derived from AsyncCompletedEventArgs. Otherwise, the property will raise a TargetInvocationException with its InnerException property holding a reference to Error.

The value of the Error property is nullptr if the operation was canceled.

Notes to Inheritors

If you provide read-only properties in a derived class, make sure that you call the RaiseExceptionIfNecessary method in your property implementation. This prevents clients from accessing properties that are potentially not valid because of a failure in the asynchronous operation.

The following code example demonstrates the using the Error property to inform a client that an asynchronous operation failed. This code example is part of a larger example provided for the System.ComponentModel::AsyncOperationManager class.

No code example is currently available or this language may not be supported.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: