Skip to content

Commit 171f4dd

Browse files
authored
Merge pull request #20686 from ramezgerges/win32_wpi_error_check
chore: remove error check for SetProcessDpiAwarenessContext
2 parents b3d6921 + a039768 commit 171f4dd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Uno.UI.Runtime.Skia.Win32.Support/DpiBootstrap.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ internal static void Init()
3636
//
3737
// This call must be made BEFORE any window is initialized.
3838

39-
var success = PInvoke.SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
40-
if (!success) { typeof(DpiBootstrap).LogError()?.Error($"{nameof(PInvoke.SetProcessDpiAwarenessContext)} failed: {GetErrorMessage()}"); }
39+
// This call won't succeed when running directly from the executable generated by the compiler. It will only
40+
// work when the program is run as `dotnet mainassembly.dll`. In case of failure, we depend on
41+
// the SetThreadDpiAwarenessContext made during the first window init.
42+
PInvoke.SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
4143
}
4244

4345
private static string GetErrorMessage() => GetErrorMessage((uint)Marshal.GetLastWin32Error());

0 commit comments

Comments
 (0)