diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorUI.csproj b/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorUI.csproj index 9eefa8fb57..2614a39913 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorUI.csproj +++ b/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorUI.csproj @@ -15,6 +15,11 @@ Assets\KeyboardManagerEditor\Keyboard.ico false false + + true PowerToys.KeyboardManagerEditorUI ..\..\..\..\$(Platform)\$(Configuration)\WinUI3Apps diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorXAML/App.xaml.cs b/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorXAML/App.xaml.cs index 17930550bc..2e6463592c 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorXAML/App.xaml.cs +++ b/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorXAML/App.xaml.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; -using System.Threading.Tasks; using KeyboardManagerEditorUI.Helpers; using KeyboardManagerEditorUI.Settings; using ManagedCommon; @@ -40,12 +39,12 @@ namespace KeyboardManagerEditorUI /// public App() { - this.InitializeComponent(); + // Initialize the logger synchronously, before anything else can log. Doing this on a + // background task races window creation, so a failure during startup leaves no trace + // at all - which is exactly what happened in #49399. + Logger.InitializeLogger("\\Keyboard Manager\\WinUI3Editor\\Logs"); - Task.Run(() => - { - Logger.InitializeLogger("\\Keyboard Manager\\WinUI3Editor\\Logs"); - }); + this.InitializeComponent(); UnhandledException += App_UnhandledException; @@ -58,6 +57,8 @@ namespace KeyboardManagerEditorUI /// Details about the launch request and process. protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) { + Logger.LogInfo("keyboard-manager WinUI3 editor is creating its main window"); + MainWindow = new MainWindow(); MainWindow.DispatcherQueue.TryEnqueue(() => diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorXAML/MainWindow.xaml.cs b/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorXAML/MainWindow.xaml.cs index 9e9ccb6cf2..4a52360868 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorXAML/MainWindow.xaml.cs +++ b/src/modules/keyboardmanager/KeyboardManagerEditorUI/KeyboardManagerEditorXAML/MainWindow.xaml.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Runtime.InteropServices.WindowsRuntime; using KeyboardManagerEditorUI.Helpers; +using ManagedCommon; using Microsoft.UI; using Microsoft.UI.Windowing; using Microsoft.UI.Xaml; @@ -41,6 +42,7 @@ namespace KeyboardManagerEditorUI this.SetIcon(@"Assets\KeyboardManagerEditor\Keyboard.ico"); this.SetTitleBar(titleBar); Title = "Keyboard Manager"; + WindowHelpers.ForceTopBorder1PixelInsetOnWindows10(this.GetWindowHandle()); } private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)