diff --git a/docs/changelog/v0.2.10.md b/docs/changelog/v0.2.10.md index 3320fa6..16ad1ba 100644 --- a/docs/changelog/v0.2.10.md +++ b/docs/changelog/v0.2.10.md @@ -14,6 +14,7 @@ Follow-up patch release for v0.2.9 addressing auto-updater regressions, adding a - Simplify update progress dispatch — remove redundant `Application.Invoke` wrappers around progress updates that are already called from the UI thread (introduced while fixing the freeze above) - Fix cursor position being reset to the start of the line when auto-completing commands in the CLI app — insertion point is now moved to the end of the completed text - Fix notification sounds crashing or being silently dropped when several arrive in quick succession — playback is now serialized through a semaphore that's held for the duration of each sound (using `PlaybackFinished` with a 10s safety timeout) and always released in `finally`, so back-to-back notifications queue up and play in order instead of racing the underlying audio player (fixes #20) +- Fix client crashing on startup with `No Serilog:Using configuration section is defined` under single-file publish — pass `ConfigurationReaderOptions` with the `Serilog.Sinks.File` assembly explicitly so Serilog can resolve sinks without scanning the filesystem for `.dll`s (which don't exist in a bundled exe) ## Refactoring diff --git a/src/EchoHub.Client/Program.cs b/src/EchoHub.Client/Program.cs index f86f1c3..f573467 100644 --- a/src/EchoHub.Client/Program.cs +++ b/src/EchoHub.Client/Program.cs @@ -4,6 +4,7 @@ using EchoHub.Client.Services; using EchoHub.Client.Themes; using Microsoft.Extensions.Configuration; using Serilog; +using Serilog.Settings.Configuration; using Terminal.Gui.App; // == CLI rollback: works without TUI, before anything else ================ @@ -71,8 +72,11 @@ var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: false) .Build(); +// Explicit sink-assembly reference is required under PublishSingleFile — the default +// AssemblyFinder scans for Serilog.Sinks.*.dll on disk, which don't exist in a bundled exe. +var serilogOptions = new ConfigurationReaderOptions(typeof(FileLoggerConfigurationExtensions).Assembly); Log.Logger = new LoggerConfiguration() - .ReadFrom.Configuration(configuration) + .ReadFrom.Configuration(configuration, serilogOptions) .CreateLogger(); Log.Information("EchoHub client starting");