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

WinForms note about SetHighDpiMode is confusing #980

Open
adegeo opened this issue Dec 15, 2021 · 2 comments
Open

WinForms note about SetHighDpiMode is confusing #980

adegeo opened this issue Dec 15, 2021 · 2 comments
Labels
design-proposal label for issues that are design proposal

Comments

@adegeo
Copy link
Contributor

adegeo commented Dec 15, 2021

Summary

There is a warning output in the analyze command related to using the new SetHighDpiMode API, but it's not very clear.

  1. First, my project isn't setting DPI in app.config or app.manifest so it telling me that I shouldn't do that makes no sense.

  2. Second, why is this a warning?

  3. Third, considering that .NET 6 and WinForms contains a whole new startup bootstrap, this is the least of the worries of upgrading the app. The note should instead be specific about how there is a whole new startup bootstrap and that the user should visit some aka.ms link for more information. That article could be more specific about upgrading to the new bootstrap.

    Or the upgrade should generate a new program file (named program.new.cs or something) using the namespace/type information from the project. The user could then replace their code.

[16:25:16 INF] Loaded 5 extensions
[16:25:17 INF] Using MSBuild from C:\Program Files\dotnet\sdk\6.0.100\
[16:25:17 INF] Using Visual Studio install from C:\Program Files\Microsoft Visual Studio\2022\Professional [v17]
[16:25:20 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe
[16:25:21 INF] Reference to .NET Upgrade Assistant analyzer package (Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, version 0.3.261302) needs to be added
[16:25:22 INF] Adding Microsoft.Windows.Compatibility 6.0.0
[16:25:22 INF] Reference to .NET Upgrade Assistant analyzer package (Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, version 0.3.261302) needs to be added
[16:25:22 INF] Running analyzers on MatchingGame
[16:25:23 INF] Identified 0 diagnostics in project MatchingGame
[16:25:23 INF] Running analyzers on MatchingGame.Logic
[16:25:23 INF] Identified 0 diagnostics in project MatchingGame.Logic
<<--- Here is the entry that is confusing  --->>
[16:25:23 WRN] HighDpiMode needs to set in Main() instead of app.config or app.manifest - Application.SetHighDpiMode(HighDpiMode.<setting>). It is recommended to use SystemAware as the HighDpiMode option for better results.

Motivation and goals

It's confusing that this note is a warning, and honestly, as someone using analyze, I don't really know what to do with that information if I'm new to .NET 6 + WinForms startup bootstrap changes.

In scope

N/A

Out of scope

N/A

Risks / unknowns

N/A

Examples

N/A

@adegeo adegeo added the design-proposal label for issues that are design proposal label Dec 15, 2021
@justcurious
Copy link

justcurious commented Jan 3, 2022

I appreciate you raising this issue. Seeing the HighDpiMode error confused me. It wasn't applicable to my project so I spent some time googling to find out what it meant and how I was supposed to fix it. Eventually I stumbled on this post and realised I could just ignore it. So once again, thanks, that helped me.

@sunandabalu
Copy link
Member

@adegeo Thanks for filing this issue, we will look into revising the HighDPIMode setting warning into something more meaningful for customers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-proposal label for issues that are design proposal
Projects
None yet
Development

No branches or pull requests

3 participants