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

Add SetLastError to GdiPlus methods #59096

Merged
merged 1 commit into from
Sep 15, 2021
Merged

Conversation

ericstj
Copy link
Member

@ericstj ericstj commented Sep 14, 2021

System.Drawing uses the last Win32 error in CheckErrorStatus to try to
guess at why a GdiPlus draw method failed and ignore some failures.

This was broken in .NETCore when SetLastError was removed from PINvokes.

Bring back SetLastError for all PInvokes that use CheckErrorStatus.

@ghost
Copy link

ghost commented Sep 14, 2021

Tagging subscribers to this area: @safern, @tarekgh
See info in area-owners.md if you want to be subscribed.

Issue Details

System.Drawing uses the last Win32 error in CheckErrorStatus to try to
guess at why a GdiPlus draw method failed and ignore some failures.

This was broken in .NETCore when SetLastError was removed from PINvokes.

Bring back SetLastError for all PInvokes that use CheckErrorStatus.

Author: ericstj
Assignees: -
Labels:

area-System.Drawing

Milestone: -

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the conversation in #58741, this is what the Interop team would recommend.

System.Drawing uses the last Win32 error in CheckErrorStatus to try to
guess at why a GdiPlus draw method failed and ignore some failures.

This was broken in .NETCore when SetLastError was removed from PINvokes.

Bring back SetLastError for all PInvokes that use CheckErrorStatus.
Copy link
Member

@JeremyKuhne JeremyKuhne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@ericstj ericstj merged commit ca74e9a into dotnet:main Sep 15, 2021
@ericstj
Copy link
Member Author

ericstj commented Sep 15, 2021

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1237690219

safern pushed a commit to safern/runtime that referenced this pull request Oct 8, 2021
System.Drawing uses the last Win32 error in CheckErrorStatus to try to
guess at why a GdiPlus draw method failed and ignore some failures.

This was broken in .NETCore when SetLastError was removed from PINvokes.

Bring back SetLastError for all PInvokes that use CheckErrorStatus.
Anipik pushed a commit that referenced this pull request Oct 13, 2021
* Add SetLastError to GdiPlus methods (#59096)

System.Drawing uses the last Win32 error in CheckErrorStatus to try to
guess at why a GdiPlus draw method failed and ignore some failures.

This was broken in .NETCore when SetLastError was removed from PINvokes.

Bring back SetLastError for all PInvokes that use CheckErrorStatus.

* Rev servicing version and include into packages list

Co-authored-by: Eric StJohn <ericstj@microsoft.com>
@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants