Marshal::GetExceptionForHR Method (Int32)
Converts the specified HRESULT error code to a corresponding Exception object.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- errorCode
-
Type:
System::Int32
The HRESULT to be converted.
Use the GetExceptionForHR method to get an Exception based on an HRESULT without having to call the ThrowExceptionForHR method and catch the exception.
The current IErrorInfo interface is used to construct the exception.
For the mapping from each HRESULT to its comparable exception class in the .NET Framework, see How to: Map HRESULTs and Exceptions.
requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1