CsWinRT
CsWinRT copied to clipboard
COMException for network path not found, instead of IOException
Describe the bug When I call this line with a network path that can not be found (maybe the device is offline), I get a COMException instead of the IOException that I would expect:
var file = await StorageFile.GetFileFromPathAsync(path);
The error message is correctly set to "The network path was not found. An element under the path 'X:\xxx' was not found".
This is great compared to the early days of CsWinRT, thank you very much for your hard work on this!
However, in #1393 I saw that there is a mapping of HResult to dotnet Exception types? Maybe this exception is just not yet mapped?
The HResult is 0x80070035. (Seems to be a ERROR_BAD_NETPATH from winerror.h)
To Reproduce see above.
Expected behavior An IOException is thrown.
Version Info WinAppSDK 1.4.5, no custom CsWinRT version
Note: The error message might not be exactly like this in english my system is throwing German error messages.