AsyncCompletedEventArgs::Error Property
Gets a value that indicates which error occurred during an asynchronous operation.
Namespace: System.ComponentModel
Assembly: System (in System.dll)
Property Value
Type: System::ExceptionAn 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 InheritorsIf 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.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.