dotnet / dotnet/wpf

WFAC010 build warning directly contradicts WPF guidance (WPF and WinForms can be used together)

Open
#6,811 2 comments 6 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

### .NET version

6.0

### Issue description

No issue template seems well-placed to receive feedback on build-time analyzers.

This warning appears when you use Windows Forms in a WPF application:

> WFAC010 Remove high DPI settings from app.manifest and configure via Application.SetHighDpiMode API or 'ApplicationHighDpiMode' project property

However, WPF guidance instructs you to place these settings in app.manifest:
https://github.com/microsoft/WPF-Samples/blob/main/PerMonitorDPI/readme.md#enabling-per-monitor-dpi-for-your-app

Given that this is a WPF app which only uses Windows Forms in order to make use of FolderBrowserDialog, calling System.Windows.Forms.Application.SetHighDpiMode during WPF app startup seems inappropriate.

### Steps to reproduce

1. Create a WPF app
2. Follow the WPF per-monitor DPI instructions at https://github.com/microsoft/WPF-Samples/blob/main/PerMonitorDPI/readme.md#enabling-per-monitor-dpi-for-your-app
3. Add `true`
4. Build and see the warning

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.