-
Notifications
You must be signed in to change notification settings - Fork 608
Map errno values to human-readable messages in System.Device.Gpio error handling #2436
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
base: main
Are you sure you want to change the base?
Conversation
| { | ||
| int errorCode = Marshal.GetLastWin32Error(); | ||
| string errorMessage = Marshal.GetLastPInvokeErrorMessage(); | ||
|
|
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.
@copilot please fix error SA1028: (NETCORE_ENGINEERING_TELEMETRY=Build) Code should not contain trailing whitespace with some tooling (you can run it on everything in this repo)
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.
Fixed in 0549198 - ran dotnet format whitespace across System.Device.Gpio and manually fixed remaining trailing whitespace in comments.
|
@copilot I resolved conflicts and I probably messed up the PR, please double check all changes are here |
I've verified all changes are present after the merge. ✅ Core changes:
Files with changes:
All |
…essage() Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
… code duplication Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
… helper Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
3358088 to
5141547
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Error messages currently show only numeric errno codes (e.g., "Error 5 performing I2C data transfer"), requiring developers to look up error meanings. This change uses
Marshal.GetLastPInvokeErrorMessage()(.NET 7+) to include descriptive messages.Changes
GetLastErrorMessage()method that captures both error code and message, formats as"code (message)"Example
Before:
After:
Notes
Three locations manually format errors where error code must be checked before throwing (EINTR/ENOENT comparisons). These are documented with inline comments explaining why
GetLastWin32Error()cannot be called twice.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Microsoft Reviewers: Open in CodeFlow