-
Notifications
You must be signed in to change notification settings - Fork 16.4k
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
Give a more user friendly message when plugin program file does not e… #2730
Conversation
catch (System.ComponentModel.Win32Exception ex) | ||
{ | ||
// do not use File.Exists(...), it can not handle the scenarios when the plugin file is in system environment path. | ||
if ((uint)ex.ErrorCode == 0x80004005) // file not found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: #2729
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will use native error code to find out the real problem
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it is uncommon to see "The specified executable is not a valid application for this OS platform." error. Only when run 64 bit program on 32 bit platform. or just have the bad image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's uncommon, but there is😥. Just check if it is FileNotFound, if not, throw error with (or without) native error code so we won't misleading user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally prefer to use current implementation to keep everything simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy paste from here
https://docs.microsoft.com/zh-cn/windows/win32/seccrypto/common-hresult-values?redirectedfrom=MSDN
Name | Description | Value |
---|---|---|
S_OK | Operation successful | 0x00000000 |
E_ABORT | Operation aborted | 0x80004004 |
E_ACCESSDENIED | General access denied error | 0x80070005 |
E_FAIL | Unspecified failure | 0x80004005 |
...... | ...... | ....... |
Seems we should use native error code...
95f18f5
to
e44cc54
Compare
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
x
into all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Compiled the code with Visual Studio
Require translation update
Require document update (readme.md, wikipage, etc)
What is the purpose of your pull request?
Description of your pull request and other information
At least gives a hint to user to check whether the plugin program file exists on file system.