Fix Settings crash: Run.Text needs Mode=OneWay on read-only sources

Stack trace from %LocalAppData%/PSLauncher/logs/app-*.log pinpointed the
exact line:

  System.InvalidOperationException: Une liaison TwoWay ou OneWayToSource
  ne peut pas fonctionner sur la propriété en lecture seule
  'LauncherVersion' de type SettingsViewModel.

WPF's <Run Text="{Binding ...}"> defaults to TwoWay binding (unlike
TextBlock.Text which defaults to OneWay). Bound to a `{ get; }`-only
property like LauncherVersion, the binding system tries to install a
back-channel writer at AttachToContext time, fails, and crashes the
whole window during ShowDialog().

Fix: explicit Mode=OneWay on the affected <Run>. The other read-only
view-model properties used in this dialog (MachineId, LogsDirectory,
CacheDirectory, LicenseInfo) are bound through TextBlock.Text and are
unaffected.

For posterity: serilog file sink + AppDomain.UnhandledException hook
captured the failure with the full stack — exactly the diagnostic flow
v0.5 was meant to enable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-02 08:46:05 +02:00
parent fb2a18ddf7
commit b33b35b198

View File

@@ -183,7 +183,7 @@
<TextBlock FontSize="13" <TextBlock FontSize="13"
Foreground="{StaticResource Brush.Text.Primary}"> Foreground="{StaticResource Brush.Text.Primary}">
<Run Text="Version : " /> <Run Text="Version : " />
<Run Text="{Binding LauncherVersion}" FontWeight="SemiBold" /> <Run Text="{Binding LauncherVersion, Mode=OneWay}" FontWeight="SemiBold" />
</TextBlock> </TextBlock>
<Grid Margin="0,8,0,0"> <Grid Margin="0,8,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>