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

Win11 24H2 .NET bug rendering text to image using GDI+ #12910

Open
tracktownsoftware opened this issue Feb 10, 2025 · 12 comments
Open

Win11 24H2 .NET bug rendering text to image using GDI+ #12910

tracktownsoftware opened this issue Feb 10, 2025 · 12 comments
Assignees
Labels
area-System.Drawing System.Drawing issues external-OS-issue Issue caused by an external OS component such as Common Controls.

Comments

@tracktownsoftware
Copy link

Description

Previous to 24H2, running the same code to generate an image with text produced an identical image every time that passed a pixel-by-pixel comparison test. As of 24H2 the same images generated twice fail pixel-by-pixel comparison.

This is a .NET issue. The tests pass when I use .NET Framework 4.8.

Note: I reported this bug to Windows 11 feedback before realizing this is a .NET issue (https://aka.ms/AAuckmw).

Reproduction Steps

Repo with code to reproduce the bug: https://github.com/tracktownsoftware/Win11-24H2-ImageTextBug
Press the "Compare Images" button.

Expected behavior

Expected behavior:

  • The code generates identical images every time.
  • Pixel-by-pixel comparison passes (before Windows 11 version 24H2)

Actual behavior

Actual behavior:
The same images are generated twice but fail pixel-by-pixel comparison. This started with the release of Windows 11 version 24H2.

Note: On a computer with 24H2 I changed the test app to use .NET Framework 4.8. The comparison tests passed, showing this to be a .NET issue.

Regression?

Yes this is a regression. If you run the repo test app with a Win11 version before 24H2 then it works.

Known Workarounds

Don't upgrade to Windows 11 to 24H2

Configuration

No response

Other information

No response

@dotnet-policy-service dotnet-policy-service bot added the untriaged The team needs to look at this issue in the next triage label Feb 10, 2025
@vcsjones vcsjones added the area-System.Drawing System.Drawing issues label Feb 10, 2025
@ViktorHofer
Copy link
Member

@JeremyKuhne

@JeremyKuhne JeremyKuhne transferred this issue from dotnet/runtime Feb 10, 2025
@JeremyKuhne
Copy link
Member

@tracktownsoftware Fwiw, we use the same GDI+ APIs on .NET Framework as we do in .NET.

@Olina-Zhang can you see if you can reproduce the behavior and validate that it only happens on .NET and not .NET Framework?

@JeremyKuhne JeremyKuhne removed the untriaged The team needs to look at this issue in the next triage label Feb 10, 2025
@JeremyKuhne JeremyKuhne self-assigned this Feb 10, 2025
@tracktownsoftware
Copy link
Author

@JeremyKuhne @Olina-Zhang
Thank you for looking at this. Let me know if there is anything else I can do, like adding a DN48 version of the test project to the Win11-24H2-ImageTextBug repo.

@Olina-Zhang
Copy link
Member

@Olina-Zhang can you see if you can reproduce the behavior and validate that it only happens on .NET and not .NET Framework?

We can use physical machine see the .NET and .NET framework have different results on Win11 24H2, not VMs

Image

@tracktownsoftware
Copy link
Author

tracktownsoftware commented Feb 11, 2025

Setting up a Hyper-V VM with the older 23H2 shows the NET8 test working.

Image

After updating the 23H2 Hyper-V VM to 24H2, this test now fails.

Image

edited to crop images

@JeremyKuhne
Copy link
Member

This is most likely behaving the way it does because we request different versions of GDI+ in .NET than we do in .NET Framework. .NET Framework initializes as V1, while .NET does V2.

It would be good to get a much smaller repro for this to facilitate getting GDI+ to look at this. @Olina-Zhang can you try to make a minimal repro for this? Ideally within the scratch project. It shouldn't need to run within a Form, try to repro within the Program class. I can force the version to 1 to see if the problem goes away.

@Zheng-Li01
Copy link
Member

Zheng-Li01 commented Feb 19, 2025

@JeremyKuhne , you can clone the branch https://github.com/Zheng-Li01/winforms/tree/RepoIssue12910 or used the attached project ScratchProject.zip

Note: the issue can be easily reproduced on physical machine, and only can reproduce on Azure VM on first time on myside.
Image

@JeremyKuhne
Copy link
Member

@Zheng-Li01 can you please try to cut this down to the minimal repro? In theory you should be able to get to a handful of lines of code that create a different result. Presumably any text rendering is going to generate different raw data.

@Zheng-Li01
Copy link
Member

@JeremyKuhne, have Updated the code in the branch https://github.com/Zheng-Li01/winforms/tree/RepoIssue12910 & ScratchProject.zip as below screenshot.
Image

@merriemcgaw
Copy link
Member

Thank you @Zheng-Li01 this is very helpful! @JeremyKuhne do you have everything you need to investigate?

@JeremyKuhne JeremyKuhne added the external-OS-issue Issue caused by an external OS component such as Common Controls. label Feb 26, 2025
@JeremyKuhne
Copy link
Member

I've reached out to the GDI+ team. We're not doing anything special here.

@tracktownsoftware
Copy link
Author

Thank for continuing to work on this.

We have image comparison tests for each update of our software. New images are generated and compared against thousands of baseline images. This has always worked until Win11 24H2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Drawing System.Drawing issues external-OS-issue Issue caused by an external OS component such as Common Controls.
Projects
None yet
Development

No branches or pull requests

7 participants