From 6a7f64989d463ba431b171d17319db4ff3430c75 Mon Sep 17 00:00:00 2001 From: erwan-joly Date: Fri, 14 Aug 2026 16:49:27 +1200 Subject: [PATCH 1/2] chore: bump all NuGet packages to latest Co-Authored-By: Claude Fable 5 --- src/NosCore.Shared/NosCore.Shared.csproj | 8 ++++---- test/NosCore.Shared.Tests/NosCore.Shared.Tests.csproj | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/NosCore.Shared/NosCore.Shared.csproj b/src/NosCore.Shared/NosCore.Shared.csproj index 4f18100..1d21dd5 100644 --- a/src/NosCore.Shared/NosCore.Shared.csproj +++ b/src/NosCore.Shared/NosCore.Shared.csproj @@ -29,12 +29,12 @@ - + - - + + - + diff --git a/test/NosCore.Shared.Tests/NosCore.Shared.Tests.csproj b/test/NosCore.Shared.Tests/NosCore.Shared.Tests.csproj index 7022ef6..b187c5d 100644 --- a/test/NosCore.Shared.Tests/NosCore.Shared.Tests.csproj +++ b/test/NosCore.Shared.Tests/NosCore.Shared.Tests.csproj @@ -8,11 +8,11 @@ - - + + - - + + From fbe53018d2e72e5e9db21ae2779dac8f4024d6ef Mon Sep 17 00:00:00 2001 From: erwan-joly Date: Sun, 23 Aug 2026 13:29:05 +1200 Subject: [PATCH 2/2] fix: PrintHeader kills headless startup when no console is attached Console.WindowWidth/WindowHeight throw IOException when the process has no console at all (Windows service, container, detached process manager), so the banner took the server down before it did any work. Read the width once through a guarded helper and fall back to the same narrow layout already used when the window height is unknown. Co-Authored-By: Claude Opus 5 (1M context) --- src/NosCore.Shared/I18N/Logger.cs | 21 ++++++++++++++++++--- src/NosCore.Shared/NosCore.Shared.csproj | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/NosCore.Shared/I18N/Logger.cs b/src/NosCore.Shared/I18N/Logger.cs index afe8c1e..080e65b 100644 --- a/src/NosCore.Shared/I18N/Logger.cs +++ b/src/NosCore.Shared/I18N/Logger.cs @@ -14,6 +14,8 @@ namespace NosCore.Shared.I18N { public static class Logger { + private const int HeadlessWindowWidth = 21; + private static IConfigurationRoot? _configuration; private static readonly string[] AsciiTitle = { @@ -40,16 +42,29 @@ public static void PrintHeader(string text) var titleLogger = new LoggerConfiguration() .WriteTo.Console(outputTemplate: "{Message:lj}{NewLine}") .CreateLogger(); - var offset = Console.WindowWidth / 2 + text?.Length / 2; - var separator = new string('=', Console.WindowHeight > 0 ? Console.WindowWidth - 1 : 20); + var width = GetWindowWidth(); + var offset = width / 2 + text?.Length / 2; + var separator = new string('=', width - 1); titleLogger.Information(separator); foreach (var s in AsciiTitle) { - titleLogger.Information(string.Format(CultureInfo.CurrentCulture, "{0," + (Console.WindowWidth / 2 + s.Length / 2) + "}", s)); + titleLogger.Information(string.Format(CultureInfo.CurrentCulture, "{0," + (width / 2 + s.Length / 2) + "}", s)); } titleLogger.Information(string.Format(CultureInfo.CurrentCulture, "{0," + offset + "}", text)); titleLogger.Information(separator); } + + private static int GetWindowWidth() + { + try + { + return Console.WindowHeight > 0 ? Console.WindowWidth : HeadlessWindowWidth; + } + catch (IOException) + { + return HeadlessWindowWidth; + } + } } } \ No newline at end of file diff --git a/src/NosCore.Shared/NosCore.Shared.csproj b/src/NosCore.Shared/NosCore.Shared.csproj index 1d21dd5..42a8d25 100644 --- a/src/NosCore.Shared/NosCore.Shared.csproj +++ b/src/NosCore.Shared/NosCore.Shared.csproj @@ -12,7 +12,7 @@ https://github.com/NosCoreIO/NosCore.Dao.git nostale, noscore, nostale private server source, nostale emulator - 6.0.0 + 6.0.1 false NosCore's Shared Components