Hello,
I've found a new bug regarding per-monitor DPI awareness in the latest WPF controls build (2020.1.115).
Applications start fine on the modern Windows 10 systems (1607 or later) but crash on previous Windows versions.
The conditions to reproduce:
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
Here is the stack trace:
System.EntryPointNotFoundException: Unable to find an entry point named 'GetDpiForSystem' in DLL 'User32.dll'.
at Telerik.Windows.Controls.InternalWindow.Standard.NativeMethods.GetDpiForSystem()
at Telerik.Windows.Controls.InternalWindow.Standard.DpiHelper.GetSystemScaleFactor()
at Telerik.Windows.Controls.InternalWindow.Standard.DpiHelper.CalculateScaleFactor(IntPtr hwnd)
at Telerik.Windows.Controls.InternalWindow.Standard.DpiHelper.GetPerMonitorDPIAwareScaleFactor(IntPtr hwnd)
at Telerik.Windows.Controls.InternalWindow.ChromelessWindowHelper.<Initialize>b__81_0(Object sender, EventArgs args)
at System.Windows.Window.OnSourceInitialized(EventArgs e)
at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
at System.Windows.Window.CreateSourceWindowDuringShow()
at System.Windows.Window.SafeCreateWindowDuringShow()
at System.Windows.Window.ShowHelper(Object booleanBox)
at System.Windows.Window.Show()
at Telerik.Windows.Controls.InternalWindow.WindowWithNoChromeWindowHost.Open(Boolean isModal)
at Telerik.Windows.Controls.WindowBase.ShowWindow(Boolean isModal)
at Telerik.Windows.Controls.RadWindow.Show()
at TelerikWpfCrash.App.OnStartup(StartupEventArgs e) in C:\Users\fedarovich\source\repos\Test\TelerikWpfCrash\TelerikWpfCrash\App.xaml.cs:line 20
The issue happens because the code calls the WinAPI functions not available on these OS versions (for example, GetDpiForSystem, but maybe there are more).
I've attached a small example to reproduce this issue. It is for .Net Core 3.1, but the same issue exists in .Net Framework too.