IAsyncInfo IAsyncInfo IAsyncInfo IAsyncInfo IAsyncInfo Interface


Supports asynchronous actions and operations. IAsyncInfo is a base interface for IAsyncAction, IAsyncActionWithProgress;, IAsyncOperation; and IAsyncOperationWithProgress;, each of which support combinations of return type and progress for an asynchronous method.

public : interface IAsyncInfo
struct winrt::Windows::Foundation::IAsyncInfo
public interface IAsyncInfo
Public Interface IAsyncInfo
// You can't instantiate an interface directly in JavaScript. You can use objects that implement the interface, however.
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.FoundationContract (introduced v1)


IAsyncInfo is an inherited interface for each of the 4 Windows Runtime interfaces that are used for asynchronous method support. These are:

When you use asynchronous methods in your app code, you usually don't see any of these interfaces as the return value. That's because you almost always use the language-specific awaitable syntax, which handles the interfaces internally. For more info, see Asynchronous programming, or one of the language-specific guides to Windows Runtime asynchronous programming (Call asynchronous APIs in C# or Visual Basic, C++, JavaScript).

For most app code, it's uncommon to use IAsyncInfo as an API even if you don't use an awaitable syntax. Each of the languages has extension points that are generally easier to use than is the Windows Runtime@Windows.Foundation.IAsyncInfo?text=IAsyncInfo interface. JavaScript has the then/done syntax. .NET has the AsTask extension method, and once the IAsyncAction is converted to a Task, it's easier to cancel, get notification on completion, and so on. For C++/CX, you can wrap the calls using the Concurrency runtime. In other words, IAsyncInfo is runtime-level infrastructure, which each of the languages use as a framework to support awaitable syntax in their own way.

If you're implementing a custom action or custom operation (an advanced scenario) don't implement IAsyncAction directly. Implement one of the 4 interfaces previously listed instead.


ErrorCode ErrorCode ErrorCode ErrorCode ErrorCode

Gets a string that describes an error condition of the asynchronous operation.

public : HResult ErrorCode { get; }
HResult ErrorCode();
public Exception ErrorCode { get; }
Public ReadOnly Property ErrorCode As Exception
var exception = iAsyncInfo.errorCode;
Exception Exception Exception

The error string.


Error codes are exposed as different types depending on the programming language you are using. Similarly, each language has different techniques for wrapping asynchronous method calls so that error conditions or cancellation can be handled. For more info see one of these topics:

See Also

Id Id Id Id Id

Gets the handle of the asynchronous operation.

public : unsigned int Id { get; }
uint32_t Id();
public uint Id { get; }
Public ReadOnly Property Id As uint
var uint = iAsyncInfo.id;
uint uint uint

The handle of the asynchronous operation.

Status Status Status Status Status

Gets a value that indicates the status of the asynchronous operation.

public : AsyncStatus Status { get; }
AsyncStatus Status();
public AsyncStatus Status { get; }
Public ReadOnly Property Status As AsyncStatus
var asyncStatus = iAsyncInfo.status;
AsyncStatus AsyncStatus AsyncStatus

The status of the operation, as a value of the enumeration. A value of Completed indicates that the method has returned. The Started value represents a transition state before any of the other 3 final results (Completed, Error, Canceled) can be determined by the method's invocation.

See Also


Cancel() Cancel() Cancel() Cancel() Cancel()

Cancels the asynchronous operation.

public : void Cancel()
void Cancel() const;
public void Cancel()
Public Function Cancel() As void

Close() Close() Close() Close() Close()

Closes the asynchronous operation.

public : void Close()
void Close() const;
public void Close()
Public Function Close() As void
// This member is not implemented in JavaScript


Calling this method indicates that you have finished with the results of the operation. After calling Close, do not call the GetResults method again (each of the 4 IAsyncInfo derived interfaces have their own implementation of GetResults.)

See Also

See Also