Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HResult structure

Represents a Windows Runtime error.

.NET:  When programming with .NET, this type is hidden, and exceptions appear as System.Exception or specific derived exception types. See Remarks.

Syntax


var hResult = {
    value : /* Your value */
}

Members

The HResult structure has these fields.

FieldData typeDescription
Value | value

Number [JavaScript] | int32 [C++]

An integer that describes an error.

 

Remarks

When programming with .NET, this class is hidden. All exceptions that are visible to .NET programming are instead reported as an instance of the System.Exception class, or a specific derivative exception (a standard exception) where the exception type encapsulates a more detailed meaning or scenario for the exception. This is true for first-chance exceptions you encounter while developing, run-time exceptions, and any exceptions that you can handle at the app level using the UnhandledException technique.

For more info on how to handle exceptions using C# or Visual Basic, see Exception handling for Windows Runtime apps in C# or Visual Basic.

For more info on how to handle exceptions using Visual C++ component extensions (C++/CX), see Exceptions (C++/CX).

For more info on how to handle errors in JavaScript, see JavaScript Run-time Errors.

The Windows Runtime HResult is based on the Windows Error codes model. The Value field combines all the parts of a conventional HRESULT as a single integer (preceding bits, facility, error code). The Windows Runtime does have its own facility, but also uses (and can throw) error codes defined by other facilities.

Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.FoundationContract, introduced version 1.0

Namespace

Windows.Foundation
Windows::Foundation [C++]

Metadata

Windows.Foundation.FoundationContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.Foundation
Windows::Foundation [C++]

Metadata

Windows.winmd

Attributes

[Version(0x06020000)]

See also

Exception handling for Windows Runtime apps in C# or Visual Basic
Exceptions (C++/CX)
JavaScript Run-time Errors
Application.UnhandledException
Debug apps in Visual Studio

 

 

Show:
© 2015 Microsoft