From 8b3b53bba7b1cc7bc711052d288d7e41674a150f Mon Sep 17 00:00:00 2001 From: VirxEC Date: Sun, 7 Jun 2026 19:41:46 -0500 Subject: [PATCH 1/7] Migrate to Tomlyn 2.5.0 --- RLBotCS/ManagerTools/ConfigParser.cs | 28 +++++++++++++++++++++++----- RLBotCS/RLBotCS.csproj | 4 +--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/RLBotCS/ManagerTools/ConfigParser.cs b/RLBotCS/ManagerTools/ConfigParser.cs index 3bfcdc6..4a63d28 100644 --- a/RLBotCS/ManagerTools/ConfigParser.cs +++ b/RLBotCS/ManagerTools/ConfigParser.cs @@ -4,6 +4,7 @@ using RLBotCS.Model; using Tomlyn; using Tomlyn.Model; +using Tomlyn.Serialization; namespace RLBotCS.ManagerTools; @@ -16,6 +17,7 @@ public static class Fields public const string RlBotLauncherArg = "launcher_arg"; public const string RlBotAutoStartAgents = "auto_start_agents"; public const string RlBotWaitForAgents = "wait_for_agents"; + public const string RlBotPerformanceMonitor = "performance_monitor"; public const string MatchTable = "match"; public const string MatchGameMode = "game_mode"; @@ -27,7 +29,6 @@ public static class Fields public const string MatchStateSetting = "enable_state_setting"; public const string MatchAutoSaveReplays = "auto_save_replays"; public const string MatchFreePlay = "freeplay"; - public const string MatchPerformanceMonitor = "performance_monitor"; public const string MutatorsTable = "mutators"; public const string MutatorsMatchLength = "match_length"; @@ -112,7 +113,21 @@ public class ConfigParserException(string? message, Exception? innerException = private readonly ConfigContextTracker _context = new(); /// Holds field names that were not present in the config. Used for debugging. - private readonly List _missingValues = new(); + private readonly List _missingValues = []; + + /// + /// AOT-safe TOML serializer context for parsing documents into . + /// + private sealed class ParserTomlContext : TomlSerializerContext + { + public static readonly ParserTomlContext Default = new(); + + private ParserTomlContext() + : base(new()) { } + + public override TomlTypeInfo? GetTypeInfo(Type type, TomlSerializerOptions options) => + type == typeof(TomlTable) ? GetBuiltInTypeInfo(options) : null; + } private TomlTable LoadTomlFile(string path) { @@ -127,7 +142,10 @@ private TomlTable LoadTomlFile(string path) } path = Path.GetFullPath(path); - return Toml.ToModel(File.ReadAllText(path), path); + return TomlSerializer.Deserialize( + File.Open(path, FileMode.Open), + ParserTomlContext.Default + )!; } catch (Exception e) { @@ -729,7 +747,7 @@ public MatchConfigurationT LoadMatchConfig(string path) path = Path.GetFullPath(path); TomlTable outerTable = LoadTomlFile(path); - MatchConfigurationT matchConfig = new MatchConfigurationT(); + MatchConfigurationT matchConfig = new(); TomlTable rlbotTable = GetValue(outerTable, Fields.RlBotTable, []); using (_context.Begin(Fields.RlBotTable)) @@ -752,7 +770,7 @@ public MatchConfigurationT LoadMatchConfig(string path) ); matchConfig.PerformanceMonitor = GetEnum( rlbotTable, - Fields.MatchPerformanceMonitor, + Fields.RlBotPerformanceMonitor, PerformanceMonitor.ShowWhenSuboptimal ); } diff --git a/RLBotCS/RLBotCS.csproj b/RLBotCS/RLBotCS.csproj index b0f5afb..bf19692 100644 --- a/RLBotCS/RLBotCS.csproj +++ b/RLBotCS/RLBotCS.csproj @@ -10,16 +10,14 @@ Speed true true - true true - true lld true - + From a7b2293fff5f6a1188303a87fa3f2865fefea240 Mon Sep 17 00:00:00 2001 From: VirxEC Date: Sun, 7 Jun 2026 19:42:20 -0500 Subject: [PATCH 2/7] Run Linux CI build inside Debian container --- .github/workflows/build.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2583d6d..8952208 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,13 +35,25 @@ jobs: build-linux: runs-on: ubuntu-latest + container: + image: debian:bookworm-slim steps: + - name: Install prerequisites + run: | + apt-get update + apt-get install -y --no-install-recommends clang lld + - name: Checkout uses: actions/checkout@v6 with: submodules: "recursive" + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "10.0.x" + - name: Test run: dotnet test From 29b88f014896629c5876497f54fdc6923e898f61 Mon Sep 17 00:00:00 2001 From: VirxEC Date: Sun, 7 Jun 2026 19:45:12 -0500 Subject: [PATCH 3/7] Install git in Linux CI --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8952208..6125a67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: - name: Install prerequisites run: | apt-get update - apt-get install -y --no-install-recommends clang lld + apt-get install -y --no-install-recommends clang lld git - name: Checkout uses: actions/checkout@v6 From e8904faf0ebd05d9b976d9579608d3d3c2ea4c16 Mon Sep 17 00:00:00 2001 From: VirxEC Date: Sun, 7 Jun 2026 19:47:26 -0500 Subject: [PATCH 4/7] Install ca-certificates in Linux CI --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6125a67..b82095b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: - name: Install prerequisites run: | apt-get update - apt-get install -y --no-install-recommends clang lld git + apt-get install -y --no-install-recommends ca-certificates clang lld git - name: Checkout uses: actions/checkout@v6 From ac4b91e3a0a04eea632cdf3b1ac6724568d5946a Mon Sep 17 00:00:00 2001 From: VirxEC Date: Sun, 7 Jun 2026 19:55:24 -0500 Subject: [PATCH 5/7] Add curl and update setup-dotnet to v5 --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b82095b..2007dff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: - name: Install prerequisites run: | apt-get update - apt-get install -y --no-install-recommends ca-certificates clang lld git + apt-get install -y --no-install-recommends ca-certificates clang lld git curl - name: Checkout uses: actions/checkout@v6 @@ -50,7 +50,7 @@ jobs: submodules: "recursive" - name: Setup .NET - uses: actions/setup-dotnet@v4 + uses: actions/setup-dotnet@v5 with: dotnet-version: "10.0.x" From 51d8686a2a0900f285b0f7a08ca5113071c7d0f9 Mon Sep 17 00:00:00 2001 From: VirxEC Date: Sun, 7 Jun 2026 19:56:40 -0500 Subject: [PATCH 6/7] Dispose file stream in ConfigParser deserialize - Allow parallel reads to open toml file --- RLBotCS/ManagerTools/ConfigParser.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RLBotCS/ManagerTools/ConfigParser.cs b/RLBotCS/ManagerTools/ConfigParser.cs index 4a63d28..c64bd5c 100644 --- a/RLBotCS/ManagerTools/ConfigParser.cs +++ b/RLBotCS/ManagerTools/ConfigParser.cs @@ -142,8 +142,9 @@ private TomlTable LoadTomlFile(string path) } path = Path.GetFullPath(path); + using var stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read); return TomlSerializer.Deserialize( - File.Open(path, FileMode.Open), + stream, ParserTomlContext.Default )!; } From 34652a8efb2bf038f8b2798ef83bc14da52b42ac Mon Sep 17 00:00:00 2001 From: VirxEC Date: Sun, 7 Jun 2026 19:58:04 -0500 Subject: [PATCH 7/7] Format project --- RLBotCS/ManagerTools/ConfigParser.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/RLBotCS/ManagerTools/ConfigParser.cs b/RLBotCS/ManagerTools/ConfigParser.cs index c64bd5c..0174e59 100644 --- a/RLBotCS/ManagerTools/ConfigParser.cs +++ b/RLBotCS/ManagerTools/ConfigParser.cs @@ -143,10 +143,7 @@ private TomlTable LoadTomlFile(string path) path = Path.GetFullPath(path); using var stream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read); - return TomlSerializer.Deserialize( - stream, - ParserTomlContext.Default - )!; + return TomlSerializer.Deserialize(stream, ParserTomlContext.Default)!; } catch (Exception e) {