Properly convert COM error codes to C# exceptions