Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMException for network path not found, instead of IOException #1508

Open
Marv51 opened this issue Feb 19, 2024 · 0 comments
Open

COMException for network path not found, instead of IOException #1508

Marv51 opened this issue Feb 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Marv51
Copy link

Marv51 commented Feb 19, 2024

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.

@Marv51 Marv51 added the bug Something isn't working label Feb 19, 2024
@Marv51 Marv51 changed the title COMException for Networkpath not found, instead of IOException COMException for Network path not found, instead of IOException Feb 19, 2024
@Marv51 Marv51 changed the title COMException for Network path not found, instead of IOException COMException for network path not found, instead of IOException Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant