Completed
Last Updated: 20 Jan 2020 07:21 by ADMIN
Release LIB 2020.1.120 (1/20/2020)
Alexander
Created on: 16 Jan 2020 09:29
Category: Window
Type: Bug Report
0
Crash when per-monitor DPI awareness is enabled on Windows 8.1/2012R2

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:

  • The application is launched on Windows version older than Windows 10 1607/Windows Server 2016. I've reproduced it on Windows 8.1/Windows Server 2012 R2, but I suppose it also affects Windows 10 1507/1511, and probably Windows 8/Windows Server 2012.
  • Application manifest contains:
<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.

Attached Files:
1 comment
ADMIN
Kalin
Posted on: 20 Jan 2020 07:21

Hi Alexander,

Thanks for report.

We reproduced and fixed the issue - the fix will be available with the internal build today. Please test it and let me know if everything works as expected now.

I updated your Telerik points for your involvement.

Regards,
Kalin
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.