dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.4k stars 977 forks source link

EXIF data misreading in WinForms VB application on Windows 11 24H2 #12338

Open Syareel-Sukeri opened 3 days ago

Syareel-Sukeri commented 3 days ago

.NET version

.Net 9.0 SDK: 9.0.100-RC.2.24474.11

Did it work in .NET Framework?

No

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No, repro in .NET 8.0

Issue description

In .NET Core and Framework application, reading EXIF data from images on Windows 11 24H2 returns incorrect EXIF values. Specifically, when retrieving the orientation flag, the system returns the value 5091 instead of the expected 112. Additionally, when running the provided code, the message box with "works" appears as expected on Windows 11 23H2, indicating the correct EXIF orientation flag is found. However, on Windows 11 24H2, the message box does not appear, suggesting the EXIF orientation flag is not being correctly identified. The issue occurs despite using the same project and the same image file. This problem does not appear on earlier versions of Windows, such as Windows 11 23H2 or Windows 10, where the correct value of 112 is consistently returned. If this issue does not belong to the WinForms team, I kindly request your guidance on the appropriate team or area to which it should be forwarded for further investigation. Attached below are the screenshots displaying the results of the debug inspection in the provided code and video of the running process.

Windows 11 Enterprise 23H2 Image

https://github.com/user-attachments/assets/56e263e6-51f7-437b-bc7d-490000185e39

Windows 11 Enterprise 24H2 Image

https://github.com/user-attachments/assets/6e4b3042-2b05-4e32-af4f-312b871449d0

Steps to reproduce

  1. Create a Winforms VB .NET application
  2. Add a PictureBox control to the form.
  3. Use the following code in the Form1_Load event:
        Me.PictureBox1.Image = Bitmap.FromFile("C:\Path\To\Your\Image.jpg")
        For Each EXIF As System.Drawing.Imaging.PropertyItem In Me.PictureBox1.Image.PropertyItems
          ' Value 112 is the orientation flag from the EXIF data
          If EXIF.Id.ToString("X") = "112" Then
                MsgBox("works")
           End If
         Next
  4. Replace ("C:\Path\To\Your\Image.jpg") with the path to an image that contains EXIF data.
  5. Run the project on both Windows 11 23H2 and 24H2.

More Info

  1. The issue is from customer feedback ticket: FeedbackTicket 2275675 Reading EXIF data from images fails since Windows 11 24H2 (visualstudio.com)
JeremyKuhne commented 2 days ago

This is a known issue with WIC that has been fixed. When that fix will show up has not been finalized.   Microsoft internal only link