System.Exception has a protected property HResult. To read the property, use System.Runtime.InteropServices.Marshal.GetHRForException().