HResult HResult HResult HResult HResult Struct


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.

public : struct HResult
struct winrt::Windows::Foundation::HResult
public struct HResult
Public Structure HResult
var hResult = {

   value: /* Your value */


Windows 10 requirements

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


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 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.


Value Value Value Value Value

An integer that describes an error.

See also