From d54b8a789efd47fefe094a3ed515a758ea5377bc Mon Sep 17 00:00:00 2001 From: Erik Date: Sat, 15 Aug 2026 07:31:34 +0200 Subject: [PATCH] =?UTF-8?q?fix(launcher):=20Campaign=20LA=20=E2=80=94=20Ma?= =?UTF-8?q?inWindow=20must=20call=20InitializeComponent,=20not=20AvaloniaX?= =?UTF-8?q?amlLoader.Load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every click in the launcher exited the process. MainWindow ctor called AvaloniaXamlLoader.Load(this), which loads the XAML tree but never assigns the generated x:Name backing fields, so ProfilesTree, ServerNameTextBox, AccountNameTextBox, CharacterNameTextBox, EditorSubmitButton, FirstRunDatDirectoryTextBox and UpdateCloseButton were all null. Opening or closing any modal calls Focus() on one of them via OnViewModelPropertyChanged, so the NullReferenceException escaped the dispatcher and Program's top-level guard exited 74. A fresh isolated-root start auto-opens the first-run wizard and hit the same line with no click at all. App.axaml.cs keeps AvaloniaXamlLoader.Load - that is the correct idiom for Application.Initialize(), which has no named controls. Verified live: the isolated-root launch that died instantly now stays up with the first-run wizard open and the window responding. Co-Authored-By: Claude Fable 5 --- src/AcDream.Launcher/MainWindow.axaml.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/AcDream.Launcher/MainWindow.axaml.cs b/src/AcDream.Launcher/MainWindow.axaml.cs index cf39085d..90f6c3be 100644 --- a/src/AcDream.Launcher/MainWindow.axaml.cs +++ b/src/AcDream.Launcher/MainWindow.axaml.cs @@ -18,7 +18,13 @@ public sealed partial class MainWindow : Window public MainWindow() { - AvaloniaXamlLoader.Load(this); + // InitializeComponent(), not AvaloniaXamlLoader.Load(this): only the + // generated method assigns the x:Name backing fields. Loading the XAML + // directly leaves every named control (ProfilesTree, the editor text + // boxes, FirstRunDatDirectoryTextBox, UpdateCloseButton, ...) null, so + // the first modal open or close threw NullReferenceException out of the + // dispatcher and took the whole process down through Program's guard. + InitializeComponent(); _statusTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(250),