Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Implement NativeLibrary.GetEntryPointModuleHandle #57610
Implement NativeLibrary.GetEntryPointModuleHandle #57610
Changes from 15 commits
e4e799c
5f16ec8
e0542ee
57643bc
4843165
376cd45
d19ed4a
d50f07f
d338682
3710af5
93fc783
58554e0
952903e
9087136
071b119
af32231
d71bc7b
4db27cb
5c61dfb
9c41825
5f36838
e9b70ae
4d58716
31fe53b
19bd0a9
b31fd00
d191560
745c9bc
efc285f
3f020e8
c9a9dba
7ffac68
a175e5c
81f9daa
a6117ba
2d4959a
f17ec5a
b8aa4fe
4e7a69c
c58228b
6bc7f4c
4266aab
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This still does not look right for non-Windows. This assumes that the Unix native PInvoke errors codes are the same as Win32 error codes which they certainly are not.
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.
Do we have a generalized mechanism today for converting a Unix
errno
value to an exception or a pattern I should follow for converting the error code to an exception on non-Windows platforms?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.
We do not. (The closest one is
GetExceptionForIoErrno
, but it is very IO scenario focused and it may not produce the right result here.)I think we typically use
throw new Win32Exception()
in situation like this one that are expected to never throw in practice. Despite its name, Win32Exception on non-Windows treats the error code as the platform specific error code (not as Windows error code).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.
Currently
Win32Exception
lives inMicrosoft.Win32.Primitives
(it seems to be the only type left in that assembly). Do we want to move it down into CoreLib as part of this change, or should I do that as part of a separate PR?I definitely think it's the right exception for this scenario. It looks to have support for pulling out the exception message using the correct platform-native API for Windows and Unix platforms, which is quite nice.
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.
I think it would be nice to do it in a separate PR for clarity.