From c31ecdda99883bb2c51aebcb250080190160d3e4 Mon Sep 17 00:00:00 2001 From: jess Date: Thu, 23 Apr 2026 07:27:11 -0700 Subject: [PATCH] gaadgdg --- shell/windows/LayersShell/App.xaml.cs | 43 ++++++++++++++++++-- shell/windows/LayersShell/MainWindow.xaml.cs | 29 ++++++++++--- 2 files changed, 64 insertions(+), 8 deletions(-) diff --git a/shell/windows/LayersShell/App.xaml.cs b/shell/windows/LayersShell/App.xaml.cs index ccec462..109b776 100644 --- a/shell/windows/LayersShell/App.xaml.cs +++ b/shell/windows/LayersShell/App.xaml.cs @@ -1,3 +1,5 @@ +using System; +using System.IO; using Microsoft.UI.Xaml; namespace LayersShell; @@ -8,12 +10,47 @@ public partial class App : Application public App() { - InitializeComponent(); + Log("App ctor enter"); + try + { + InitializeComponent(); + AppDomain.CurrentDomain.UnhandledException += (_, e) => + Log($"UnhandledException: {e.ExceptionObject}"); + UnhandledException += (_, e) => + Log($"XAML UnhandledException: {e.Exception}"); + Log("App ctor ok"); + } + catch (Exception ex) + { + Log($"App ctor FAILED: {ex}"); + throw; + } } protected override void OnLaunched(LaunchActivatedEventArgs args) { - _window = new MainWindow(); - _window.Activate(); + Log("OnLaunched enter"); + try + { + _window = new MainWindow(); + Log("MainWindow constructed"); + _window.Activate(); + Log("MainWindow activated"); + } + catch (Exception ex) + { + Log($"OnLaunched FAILED: {ex}"); + throw; + } + } + + internal static void Log(string line) + { + try + { + var path = Path.Combine(Path.GetTempPath(), "layers-shell.log"); + File.AppendAllText(path, DateTime.Now.ToString("HH:mm:ss.fff ") + line + Environment.NewLine); + } + catch { } } } diff --git a/shell/windows/LayersShell/MainWindow.xaml.cs b/shell/windows/LayersShell/MainWindow.xaml.cs index 06b41ea..6c85723 100644 --- a/shell/windows/LayersShell/MainWindow.xaml.cs +++ b/shell/windows/LayersShell/MainWindow.xaml.cs @@ -25,9 +25,15 @@ public sealed partial class MainWindow : Window public MainWindow() { - InitializeComponent(); + App.Log("MainWindow ctor enter"); + try + { + InitializeComponent(); + } + catch (Exception ex) { App.Log($"InitializeComponent FAILED: {ex}"); throw; } Title = "Layers"; _hwnd = WindowNative.GetWindowHandle(this); + App.Log($"hwnd = {_hwnd:X}"); var appWindow = AppWindow.GetFromWindowId(Win32Interop.GetWindowIdFromWindow(_hwnd)); if (appWindow is not null) @@ -51,10 +57,23 @@ public sealed partial class MainWindow : Window DispatcherQueue.TryEnqueue(() => { - PointToRust(); - LayersNative.StartupIfNeeded(); - CreateNativeHandle(); - StartRenderLoop(); + try + { + App.Log("deferred init: PointToRust"); + PointToRust(); + App.Log("deferred init: StartupIfNeeded"); + LayersNative.StartupIfNeeded(); + App.Log("deferred init: CreateNativeHandle"); + CreateNativeHandle(); + App.Log($"deferred init: _handle = {_handle:X}"); + StartRenderLoop(); + App.Log("deferred init: render loop started"); + } + catch (Exception ex) + { + App.Log($"deferred init FAILED: {ex}"); + throw; + } }); }