Getting HRESULTs back from COM Interop calls

COM interop is one of the messy places where error by return value vs exception meet head on.  COM was built on the basis of HRESULT return values while .NET tends to use exceptions.  To compensate for that, the CLR helps out by mapping failure HRESULTs into .NET exceptions during COM Interop.  It does this…

1