Implement Marshal.Get(Last)PInvokeErrorMessage() APIs.#70685
Conversation
|
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
|
Tagging subscribers to this area: @dotnet/interop-contrib Issue DetailsThe behavior of this API is to return the same value as Fixes #67872 /cc @danmoseley @dotnet/interop-contrib
|
|
There are other places using Interop.Kernel32.GetMessage. It'd be nice to have them changed (where possible) to just call Marshal.GetPInvokeErrorMessage, e.g. There are also places doing |
The behavior of this API is to return the same value as new Win32Exception(error).Message, while avoiding the instantion of an exception.
Marshal implementation to handle the P/Invoke call. Consume new API in places where possible.
3464441 to
f498fcc
Compare
Marshal.GetPInvokeErrorMessage() API.Marshal.Get(Last)PInvokeErrorMessage() APIs.
danmoseley
left a comment
There was a problem hiding this comment.
Nice improvement, thanks
The behavior of this API is to return the same value as
new Win32Exception(error).Message, while avoiding theinstantiation of an exception.
Fixes #67872
/cc @danmoseley @dotnet/interop-contrib