Skip to content

[Multi-Monitor] PerMonitorV2 autoscale lead to wrong ClientSize. #12132

Closed

Description

@kirsan31

.NET version

8.0.7

Did it work in .NET Framework?

No.

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

.Net 5 - 7 have similar problem but the difference is match smaller.
Can't test 9.0RC1 due to build error:

(ResolvePackageAssets target) -> C:\Program Files\dotnet\sdk\9.0.100-rc.1.24452.12\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5):
error NETSDK1060: Error reading assets file: Error loading lock file 'e:\Projects\Other\core tests\WinFormsPerMonitorV2\obj\project.assets.json' :
Could not load file or assembly 'System.Text.Json, Version=8.0.0.4, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

Issue description

PerMonitorV2 app.

  • launch on screen with dpi A will result in ClientSize = CLS1. The same as launch SystemAware app.
  • launch on screen with dpi B and then drag to screen A will result in ClientSize = CLS2.

And CLS1 != CLS2.

image

Steps to reproduce

WinFormsPerMonitorV2.zip

  • launch app, change scale in windows settings.
  • launch app again - compare ClientSize values.

or

  • Change scale in windows settings to other then 100%.
  • launch app, change scale in windows settings to100%.
  • launch app again - compare ClientSize values.

Activity

  1. added
    untriaged
    on Sep 13, 2024
  2. changed the title [-][Multi-Monitor] In PerMonitorV2 mode ClientSize different when autosize and fixed start.[/-] [+][Multi-Monitor] PerMonitorV2 autosize lead to wrong ClientSize.[/+] on Sep 13, 2024
  3. changed the title [-][Multi-Monitor] PerMonitorV2 autosize lead to wrong ClientSize.[/-] [+][Multi-Monitor] PerMonitorV2 autoscale lead to wrong ClientSize.[/+] on Sep 13, 2024
  4. added
    area-HDPI
    area-HDPI-PMv2
    on Sep 13, 2024
  5. added this to the .NET 10.0 milestone on Sep 24, 2024
  6. removed
    untriaged
    on Sep 24, 2024
  7. Tanya-Solyanik commented on Sep 24, 2024

    @Tanya-Solyanik
    Contributor

    @Olina-Zhang could you please find what PR in NET8 had regressed this behavior and if the quirks can help with this issue.

  8. kirsan31 commented on Sep 24, 2024

    @kirsan31
    ContributorAuthor

    @Tanya-Solyanik

    @Olina-Zhang could you please find what PR in NET8 had regressed this behavior and if the quirks can help with this issue.

    This is not regression from .Net6 (may be earlier?):

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

    .Net 6 and 7 have same problem but difference is bigger. Can't test 9.0RC1 due to build error:

  9. Tanya-Solyanik commented on Sep 24, 2024

    @Tanya-Solyanik
    Contributor

    @kirsan31 - we want to see what caused the bigger difference.

  10. Philip-Wang01 commented on Sep 27, 2024

    @Philip-Wang01
    Contributor

    @Tanya-Solyanik This behavior is regression from: #7973 and here are the test results.
    Somewhat strangely, when running the application multiple times, it is possible to get the same results as before. Please check out the video.

    image

    test12132.mp4
  11. kirsan31 commented on Sep 27, 2024

    @kirsan31
    ContributorAuthor

    This behavior is regression from: #7973 and here are the test results.

    Sorry but I still don't get why you call this regression. 🤷‍♂️ In .Net 8 it's become more accurate then before, but still not 100% accurate.
    Correct size with 125% dpi is 715x644;
    And I think that more accurate to use second test mechanics from my 1 post (to compare with 100% DPI settings (for that we know size that we set in designer 626x483)):

    • Change scale in windows settings to other then 100%.
    • launch app, change scale in windows settings to100%.
    • launch app again - compare ClientSize values.
  12. Olina-Zhang commented on Sep 30, 2024

    @Olina-Zhang
    Member

    Correct size with 125% dpi is 715x644;

    One question: why the correct size on 125% is 715x644 based on 100%: 626x483, not 783x604 on 125%?

  13. kirsan31 commented on Sep 30, 2024

    @kirsan31
    ContributorAuthor

    @Olina-Zhang
    Omg - this is the right question! 715x644 is systemaware starting size with 125% dpi. And this size the same from .Net5 to .Net8!
    So we have new question here:
    Is 715x644 systemaware 125% dpi scaling correct for 626x483? It's seems that no...

    All my previous conclusions was made comparing to systemaware scaling and in this terms .Net8 PerMonitorV2 more close to it than .Net5-7.

  14. RussKie commented on Sep 30, 2024

    @RussKie
    Contributor

    Sorry but I still don't get why you call this regression. 🤷‍♂️ In .Net 8 it's become more accurate then before, but still not 100% accurate.
    Correct size with 125% dpi is 715x644;

    642 * 1.25 = 802.5
    522 * 1.25 = 652.5

  15. kirsan31 commented on Sep 30, 2024

    @kirsan31
    ContributorAuthor

    @RussKie

    Sorry but I still don't get why you call this regression. 🤷‍♂️ In .Net 8 it's become more accurate then before, but still not 100% accurate.
    Correct size with 125% dpi is 715x644;

    642 * 1.25 = 802.5 522 * 1.25 = 652.5

    Yea I already got it - explained in my previous post above (I couldn't imagine that systemaware scaling is wrong).

  16. kirsan31 commented on Oct 4, 2024

    @kirsan31
    ContributorAuthor

    Opened a new issue #12270. I think we need to solve #12270 before trying to fix current one.

  17. removed their assignment
    on Oct 11, 2024
  18. merriemcgaw commented on Aug 11, 2025

    @merriemcgaw
    Contributor

    @KlausLoeffelmann - this was one you wanted to look at.

  19. self-assigned this
    on Feb 6, 2026
  20. Zheng-Li01 commented on Sep 4, 2026

    @Zheng-Li01
    Member

    Verified the issue with latest .NET11 11.0.0-rc.2.26453.107 + private dlls built from main branch of dotnet/winforms repro, the issue has been fixed as below screenshot.

    Image Image
  21. locked and limited conversation to collaborators on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-HDPIarea-HDPI-PMv2

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions