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: Unable to find an entry point named 'GetDpiForMonitor' in DLL 'shcore.dll'. #7284

Closed
telikey opened this issue Dec 30, 2021 · 3 comments · Fixed by #15734

Comments

@telikey
Copy link

telikey commented Dec 30, 2021

Describe the bug
Description: The process was terminated due to an unhandled exception.
Exception Info: System.EntryPointNotFoundException: Unable to find an entry point named 'GetDpiForMonitor' in DLL 'shcore.dll'.
StackStrace:
at Avalonia.Win32.Interop.UnmanagedMethods.GetDpiForMonitor(IntPtr hmonitor, MONITOR_DPI_TYPE dpiType, UInt32& dpiX, UInt32& dpiY)
at Avalonia.Win32.WindowImpl.CreateWindow() in //src/Windows/Avalonia.Win32/WindowImpl.cs:line 773
at Avalonia.Win32.WindowImpl..ctor() in /
/src/Windows/Avalonia.Win32/WindowImpl.cs:line 123
at Avalonia.Win32.Win32Platform.CreateWindow() in //src/Windows/Avalonia.Win32/Win32Platform.cs:line 316
at Avalonia.Controls.Platform.PlatformManager.CreateWindow() in /
/src/Avalonia.Controls/Platform/PlatformManager.cs:line 48
at Avalonia.Controls.Window..ctor() in //src/Avalonia.Controls/Window.cs:line 231
at Avalonia.ReactiveUI.ReactiveWindow'1..ctor() in /
/src/Avalonia.ReactiveUI/ReactiveWindow.cs:line 26
at Client_App.Views.MainWindow..ctor() in C:\Users\Admin\Desktop\RAO_Project\Client_App\Views\MainWindow.axaml.cs:line 34
at Client_App.App.OnFrameworkInitializationCompleted() in C:\Users\Admin\Desktop\RAO_Project\Client_App\App.axaml.cs:line 19
at Avalonia.Controls.AppBuilderBase'1.Setup() in //src/Avalonia.Controls/AppBuilderBase.cs:line 312
at Avalonia.Controls.AppBuilderBase'1.SetupWithLifetime(IApplicationLifetime lifetime) in /
/src/Avalonia.Controls/AppBuilderBase.cs:line 179
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 174

Desktop (please complete the following information):

  • OS: Windows 8
  • Version 6.2.9200
  • Build 9200

Additional context
Updated Avalonia 0.10.10 from 0.10.0

@telikey telikey added the bug label Dec 30, 2021
@Symbai
Copy link
Contributor

Symbai commented Dec 30, 2021

GetDpiForMonitor requires Windows 8.1 or later. I couldn't find any system requirements for Avalonia but Windows 8(.0) is pretty much out of support anywhere. If you don't want to run into more issue you should consider upgrading.

@kekekeks
Copy link
Member

CreateWindow does check the windows version to be >8.0:

if (ShCoreAvailable && Win32Platform.WindowsVersion > PlatformConstants.Windows8)

The same check is done in
if (UnmanagedMethods.ShCoreAvailable && Win32Platform.WindowsVersion > PlatformConstants.Windows8)

ScreenImpl, however, checks using GetProcAddress:

var method = GetProcAddress(shcore, nameof(GetDpiForMonitor));

@stepangovorko
Copy link
Contributor

There is an issue with this check Win32Platform.WindowsVersion > PlatformConstants.Windows8
It returns true i.e. for Windows Server 2012, because Win32Platform.WindowsVersion=6.2.9200, but PlatformConstants.Windows8=6.2.0

yusupovdanil added a commit to yusupovdanil/Avalonia that referenced this issue May 15, 2024
Comparing WindowVersion with Windows8_1 instead of Windows8
github-merge-queue bot pushed a commit that referenced this issue May 20, 2024
Comparing WindowVersion with Windows8_1 instead of Windows8

Co-authored-by: Max Katz <maxkatz6@outlook.com>
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.

5 participants