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

EntryPointNotFoundException when Window.ShowDialog() called on Windows 1511 #16444

Open
SKasperczyk opened this issue Jul 24, 2024 · 2 comments · May be fixed by #16453
Open

EntryPointNotFoundException when Window.ShowDialog() called on Windows 1511 #16444

SKasperczyk opened this issue Jul 24, 2024 · 2 comments · May be fixed by #16453

Comments

@SKasperczyk
Copy link

Describe the bug

When trying to show window in dialog mode via Window.ShowDialog() on Windows 1511 the following exception is thrown and application crashes:
System.EntryPointNotFoundException
Unable to find an entry point named 'AdjustWindowRectExForDpi' in DLL 'user32.dll'.

To Reproduce

Execute Window.ShowDialog() on Windows 1511.

Expected behavior

Apparently AdjustWindowRectEx() should be called instead of AdjustWindowRectExForDpi() at WindowImpl.cs: RECT WindowImpl.ClientRectToWindowRect(RECT clientRect, WindowStyles? styleOverride, WindowStyles? extendedStyleOverride) for windows 1511 or earlier.

Avalonia version

11.1.0-beta1

OS

Windows

Additional context

I might be wrong, but it seems that Windows10_1607 const in PlatformConstants.cs is defined wrong.
Shouldn't it be 10.0.14393 instead of 10.0.1607. Crashed system was reported as 10.0.10586 so it might be that 10.0.10568 > 10.0.1607. Though I'm no cerain about that as I'm unable to check what Win32Platform.WindowsVersion is actually returning.

Either way, it looks like following statement:

var result = Win32Platform.WindowsVersion < PlatformConstants.Windows10_1607
                ? AdjustWindowRectEx(ref clientRect, (uint)style, false, (uint)extendedStyle)
                : AdjustWindowRectExForDpi(ref clientRect, style, false, extendedStyle, (uint)(RenderScaling * StandardDpi));

calls always AdjustWindowRectExForDpi()

@maxkatz6
Copy link
Member

I might be wrong, but it seems that Windows10_1607 const in PlatformConstants.cs is defined wrong.

That's correct. It should be 10.0.14393.

@timunie
Copy link
Contributor

timunie commented Jul 25, 2024

@SKasperczyk a PR is welcome 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants