dahall / Vanara

A set of .NET libraries for Windows implementing PInvoke calls to many native Windows APIs with supporting wrappers.
MIT License
1.81k stars 196 forks source link

The Portable Device API uses HRESULT return values for their methods #473

Closed NilsHoyer closed 4 months ago

NilsHoyer commented 4 months ago

The Portable Device API has several COM interfaces and as far I see, all their methods are giving back a HRESULT. But your implementations are not (void instead of HRESULT).

dahall commented 4 months ago

In general, I have chosen to let .NET handle HRESULT errors from COM interface methods as exceptions except in cases where the interface must be implemented in .NET or when the HRESULT can return results like S_FALSE that are more result codes than errors.

NilsHoyer commented 3 months ago

When I read your comment, I thought this would be bad implemented. Today, I love it! 😌

dahall commented 3 months ago

Thank you for the positive feedback!