System.Exception.HResult on non-Windows platforms

0

How are the values for System.Exception.HResult generated on non-Windows platforms?

In my scenario I try to catch IOException only when the file is locked by another process. The value of HResult is 0x80070020 on Windows and 0x0000000B on Linux, which would make sense as Windows and Linux use different error codes.

However when I try to open a nonexistent file the HResult is 0x8007002 on both platforms, which also would make sense for code sharing.

Is there a specified behavior for HResult on non-Windows platforms (so one of the above is a probably a bug?) or should we not bother to rely on HResult in cross-platform code?

.net-core
asked on Stack Overflow Mar 10, 2020 by Christian Held

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0