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

Ensure GDI+ is initialized for all codepaths #12501

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

JeremyKuhne
Copy link
Member

@JeremyKuhne JeremyKuhne commented Nov 17, 2024

A few places slipped through the cracks. If you call GetImageEncoders before any other System.Drawing code, you will get a fatal error.

Fixes #12494

There isn't a great way to add a regression test for this as any other call that initializes GDI+ will cause the test to not find this.

Created microsoft/CsWin32#1308 to try and make this programmatic. If this ends up being problematic, we could add another core assembly System.Private.Windows.Core.GdiPlus to handle this scenario. Said assembly would have to depend on System.Private.Windows.Core.

Microsoft Reviewers: Open in CodeFlow

A few places slipped through the cracks. If you call GetImageEncoders before any other System.Drawing code you will get a fatal error.
@JeremyKuhne JeremyKuhne requested a review from a team as a code owner November 17, 2024 18:35
@JeremyKuhne JeremyKuhne added the Servicing-consider .NET Shiproom label indicating a PR seeks to enter into a branch under Tell-Mode criteria label Nov 17, 2024
@JeremyKuhne JeremyKuhne added this to the .NET 10.0 milestone Nov 17, 2024
@JeremyKuhne
Copy link
Member Author

Need to take this to .NET 9.

Copy link

codecov bot commented Nov 17, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 75.72746%. Comparing base (98c761f) to head (b159975).
Report is 3 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #12501         +/-   ##
===================================================
- Coverage   75.72908%   75.72746%   -0.00163%     
===================================================
  Files           3151        3151                 
  Lines         635802      635805          +3     
  Branches       46978       46978                 
===================================================
- Hits          481487      481479          -8     
- Misses        150877      150883          +6     
- Partials        3438        3443          +5     
Flag Coverage Δ
Debug 75.72746% <66.66667%> (-0.00163%) ⬇️
integration 18.26342% <0.00000%> (-0.00408%) ⬇️
production 49.30077% <66.66667%> (-0.00333%) ⬇️
test 97.04481% <ø> (ø)
unit 46.28191% <66.66667%> (+0.02347%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

---- 🚨 Try these New Features:

@JeremyKuhne JeremyKuhne merged commit f0e509c into dotnet:main Nov 18, 2024
8 checks passed
@JeremyKuhne JeremyKuhne deleted the fix12494 branch November 18, 2024 02:23
JeremyKuhne added a commit to JeremyKuhne/winforms that referenced this pull request Nov 18, 2024
A few places slipped through the cracks. If you call GetImageEncoders before any other System.Drawing code you will get a fatal error.

(Port from dotnet#12501)
@JeremyKuhne JeremyKuhne added Servicing-approved .NET Shiproom approved the PR for merge and removed Servicing-consider .NET Shiproom label indicating a PR seeks to enter into a branch under Tell-Mode criteria labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Servicing-approved .NET Shiproom approved the PR for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageCodecInfo.GetImageEncoders() throws fatal exception in 9.0.0 package.
2 participants