dotnet / dotnet/wpf

[ARM64] WPF transparent window swaps red and blue color channels with hardware rendering

Open
#11,847 0 comments 0 reactions 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

On Windows 11 ARM64, WPF renders incorrect color channels when
AllowsTransparency is enabled and hardware rendering is used.

A minimal reproduction shows that pure red and pure blue are
rendered with their red and blue channels swapped:

Expected:
Red → Red
Green → Green
Blue → Blue

Actual:
Red → Blue
Green → Green
Blue → Red

The issue does not occur when:

1. AllowsTransparency is set to false, or
2. WPF hardware rendering is disabled with:

RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;

This suggests that the issue may be related to the WPF hardware
rendering path used for transparent windows on ARM64.

The same application renders the colors correctly when software
rendering is forced.

Image
Image
Image

### Environment

[DxDiag.txt](https://github.com/user-attachments/files/31217809/DxDiag.txt)

.NET SDK:
Version: 10.0.400
Commit: 14fbf8d527
Workload version: 10.0.400-manifests.b0ae88bd
MSBuild version: 18.9.6+14fbf8d52

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-arm64
Base Path: C:\Program Files\dotnet\sdk\10.0.400\

.NET workloads installed:
[maui-windows]
Installation Source: VS 18.9.12112.369
Manifest Version: 10.0.20/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maui\10.0.20\WorkloadManifest.json
Install Type: Msi

[maccatalyst]
Installation Source: VS 18.9.12112.369
Manifest Version: 26.5.10301/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maccatalyst\26.5.10301\WorkloadManifest.json
Install Type: Msi

[ios]
Installation Source: VS 18.9.12112.369
Manifest Version: 26.5.10301/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.ios\26.5.10301\WorkloadManifest.json
Install Type: Msi

[android]
Installation Source: VS 18.9.12112.369
Manifest Version: 36.1.69/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.android\36.1.69\WorkloadManifest.json
Install Type: Msi

Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
Version: 10.0.11
Architecture: arm64
Commit: e2f47b0110

.NET SDKs installed:
10.0.400 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 10.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x64 [C:\Program Files\dotnet\x64]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation]
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

### Reproduction Steps

1. Download and extract the attached reproduction project.
2. Open and run the project on a Windows 11 ARM64 device.
3. The application displays red, green, and blue color areas.
4. Use the button in the window to switch between Hardware and Software rendering.
5. When Hardware Rendering is selected, the red and blue channels are swapped:
- Red is rendered as Blue.
- Green is rendered as Green.
- Blue is rendered as Red.
6. When Software Rendering is selected, all colors are rendered correctly.

[WindowAllowsTransparencyBug.zip](https://github.com/user-attachments/files/31216914/WindowAllowsTransparencyBug.zip)

### Expected behavior

When Hardware Rendering is enabled, the colors should be rendered correctly.

Red should be displayed as red, green as green, and blue as blue.

### Actual behavior

When Hardware Rendering is enabled on Windows 11 ARM64 with
AllowsTransparency="True", the red and blue color channels are swapped.

Red is rendered as blue, green is rendered correctly, and blue is rendered as red.

The issue does not occur when:
- Software Rendering is enabled.
- AllowsTransparency is set to false.

### Regression?

_No response_

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by running the attached WindowAllowsTransparencyBug reproduction on a Windows 11 ARM64 device, comparing AllowsTransparency and RenderOptions.ProcessRenderMode hardware and software paths. Trace the WPF hardware-rendering path used for transparent windows; done means red, green, and blue render correctly with hardware rendering while the existing software and non-transparent cases remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.