From f76cb235b6de0d2dbf648abadf64983a83e31d4d Mon Sep 17 00:00:00 2001 From: JusterZhu Date: Thu, 21 May 2026 00:07:10 +0800 Subject: [PATCH] fix: simulation encoding and NuGet restore - Add UTF8 encoding to dotnet run process output/error streams - Increase run timeout from 60s to 120s (NuGet restore needs time) - Remove version glob (10.*) from #r directives (unsupported by dotnet run) --- src/Services/ClientGeneratorService.cs | 8 ++++---- src/Services/SimulationService.cs | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Services/ClientGeneratorService.cs b/src/Services/ClientGeneratorService.cs index 90ec950..252c216 100644 --- a/src/Services/ClientGeneratorService.cs +++ b/src/Services/ClientGeneratorService.cs @@ -13,8 +13,8 @@ namespace GeneralUpdate.Tools.Services; public class ClientGeneratorService { private const string ClientTemplate = """ -#r "nuget: GeneralUpdate.ClientCore, 10.*" -#r "nuget: GeneralUpdate.Core, 10.*" +#r "nuget: GeneralUpdate.ClientCore" +#r "nuget: GeneralUpdate.Core" using GeneralUpdate.ClientCore; using GeneralUpdate.Common.Shared.Object; @@ -72,8 +72,8 @@ public class ClientGeneratorService """; private const string UpgradeTemplate = """ -#r "nuget: GeneralUpdate.Core, 10.*" -#r "nuget: GeneralUpdate.ClientCore, 10.*" +#r "nuget: GeneralUpdate.Core" +#r "nuget: GeneralUpdate.ClientCore" using GeneralUpdate.Core; using GeneralUpdate.Common.Shared; diff --git a/src/Services/SimulationService.cs b/src/Services/SimulationService.cs index 0e828d9..82017a1 100644 --- a/src/Services/SimulationService.cs +++ b/src/Services/SimulationService.cs @@ -18,7 +18,7 @@ public class SimulationService private readonly ClientGeneratorService _generator = new(); private readonly LocalUpdateServer _server = new(); private readonly StringBuilder _fullLog = new(); - private int _timeoutSeconds = 60; + private int _timeoutSeconds = 120; public IReadOnlyList LogLines => _fullLog.ToString().Split('\n').ToList(); @@ -144,6 +144,8 @@ private void Validate(SimulateConfigModel config) WorkingDirectory = workDir, RedirectStandardOutput = true, RedirectStandardError = true, + StandardOutputEncoding = System.Text.Encoding.UTF8, + StandardErrorEncoding = System.Text.Encoding.UTF8, UseShellExecute = false, CreateNoWindow = true };