Skip to content

Conversation

@safern
Copy link
Member

@safern safern commented Oct 8, 2021

Backport of #59096 to release/5.0

Issue: #58741

Customer Impact

Regression from .NETFramework and .NETCore causing a unexpected ExternalException related to session transitions (sleep/wake, Remote Desktop, etc)

Testing

Manually verified in debugger. Unit tests.

Risk

Very low. Adds back SetLastError to only those PINvokes which require it.

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.
@safern safern added the Servicing-consider Issue for next servicing release review label Oct 8, 2021
@ghost ghost added the area-System.Drawing label Oct 8, 2021
@ghost
Copy link

ghost commented Oct 8, 2021

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

Issue Details

Backport of #59096 to release/5.0

Issue: #58741

Customer Impact

Regression from .NETFramework and .NETCore causing a unexpected ExternalException related to session transitions (sleep/wake, Remote Desktop, etc)

Testing

Manually verified in debugger. Unit tests.

Risk

Very low. Adds back SetLastError to only those PINvokes which require it.

Author: safern
Assignees: -
Labels:

Servicing-consider, area-System.Drawing

Milestone: -

Copy link
Member

@tarekgh tarekgh left a comment

Choose a reason for hiding this comment

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

Just wondering, does GDIplus APIs set the last errors in all cases?

@safern
Copy link
Member Author

safern commented Oct 8, 2021

does GDIplus APIs set the last errors in all cases?

@ericstj did you look for that info when doing the initial fix on main and 6.0?

@safern
Copy link
Member Author

safern commented Oct 12, 2021

/azp run runtime

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Anipik
Copy link
Contributor

Anipik commented Oct 13, 2021

failures are unrelated so merging this one.

@Anipik Anipik merged commit 5c7b1c7 into dotnet:release/5.0 Oct 13, 2021
@safern safern deleted the PortSetLastErrorGdip branch October 13, 2021 05:47
@ghost ghost locked as resolved and limited conversation to collaborators Nov 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants