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

[release/7.0] Fix Interop.Gdi32.StartDoc p/invoke #76582

Merged
merged 1 commit into from
Oct 5, 2022

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 4, 2022

Backport of #76569 to release/7.0

/cc @elinor-fung

Customer Impact

This is a customer-reported issue: #76538. An access violation occurs when trying to use System.Drawing.Printing APIs to print a document via PrintDocument.Print / StandardPrintController.OnStartPrint. This is a regression from .NET 6 without a workaround.

New in .NET 7 are source generated interop stubs. This p/invoke contained marshalling a sealed class, which previously would have been marshalled as a pointer to the native representation, but it regressed to marshaling as a copy (leading to the crash).

Testing

Validated using the customer-provided repro. No automated test was added. Automated test coverage of the printing APIs in System.Drawing.Common is limited - particularly when involving usage of OS APIs - due to the dependency on printers.

Risk

Low. The fix is targeted to one p/invoke and one type that is used by that p/invoke only.

@ghost
Copy link

ghost commented Oct 4, 2022

Tagging subscribers to this area: @dotnet/area-system-drawing
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #76569 to release/7.0

/cc @elinor-fung

Customer Impact

Testing

Risk

IMPORTANT: Is this backport for a servicing release? If so and this change touches code that ships in a NuGet package, please make certain that you have added any necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-System.Drawing

Milestone: -

@JulieLeeMSFT
Copy link
Member

@elinor-fung, please check CI failures.

@ViktorHofer ViktorHofer added the Servicing-consider Issue for next servicing release review label Oct 4, 2022
Copy link
Member

@jeffschwMSFT jeffschwMSFT left a comment

Choose a reason for hiding this comment

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

approved. we will take for consideration in 7 ga.

@jeffschwMSFT jeffschwMSFT added this to the 7.0.0 milestone Oct 4, 2022
@danmoseley
Copy link
Member

Did you consider adding a test that prints to PDF (similar to the original repro)? Worst case, we encounter some Windows SKU where drawing is supported but not print to PDF, and if that turns up we can just conditionalize the test.

It seems worth such a test if it would catch something we'd take a fix this late for.

@rbhanda rbhanda added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 4, 2022
@elinor-fung
Copy link
Member

Failures are unrelated: #74328, #76626

I looked into adding a test briefly. None of the existing tests actually try to use the normal print controller, so I thought adding one could result in chasing down intermittent test issues around conditioning based on machine environment. I'd rather not try to for 7.0, but can look into it more for main/8.0.

@danmoseley
Copy link
Member

I looked into adding a test briefly. None of the existing tests actually try to use the normal print controller, so I thought adding one could result in chasing down intermittent test issues around conditioning based on machine environment. I'd rather not try to for 7.0, but can look into it more for main/8.0.

sounds good, my suggestion would be to backport when it's proven stable in main (as printing is important to protect somehow)

@carlossanlop
Copy link
Member

Approved by Tactics, signed off, and CI Failures investigated as unrelated. Ready to merge. :shipit:

@carlossanlop carlossanlop merged commit 881db85 into release/7.0 Oct 5, 2022
@carlossanlop carlossanlop deleted the backport/pr-76569-to-release/7.0 branch October 5, 2022 17:56
@ghost ghost locked as resolved and limited conversation to collaborators Nov 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Drawing Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants