From 12d58cc082904509ef4996fb8c74b3ba1ec10d26 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 15 Nov 2025 16:37:19 +0000 Subject: [PATCH] Fix ForceDriver persistence through RuntimeConfig - Set ForceDriver in ConfigurationManager.RuntimeConfig instead of directly on Application.ForceDriver - Reload RuntimeConfig before each scenario to ensure driver persists - Remove redundant Application.ForceDriver assignment in RunScenario Co-authored-by: tig <585482+tig@users.noreply.github.com> --- Examples/UICatalog/UICatalog.cs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Examples/UICatalog/UICatalog.cs b/Examples/UICatalog/UICatalog.cs index 6f7a37139..ae546c1bc 100644 --- a/Examples/UICatalog/UICatalog.cs +++ b/Examples/UICatalog/UICatalog.cs @@ -346,7 +346,17 @@ public class UICatalog { // By setting _forceDriver we ensure that if the user has specified a driver on the command line, it will be used // regardless of what's in a config file. - Application.ForceDriver = _forceDriver = options.Driver; + _forceDriver = options.Driver; + + // If a driver has been specified, set it in RuntimeConfig so it persists through Init/Shutdown cycles + if (!string.IsNullOrEmpty (_forceDriver)) + { + ConfigurationManager.RuntimeConfig = $$""" + { + "Application.ForceDriver": "{{_forceDriver}}" + } + """; + } // If a Scenario name has been provided on the commandline // run it and exit when done. @@ -412,6 +422,13 @@ public class UICatalog Application.InitializedChanged += ApplicationOnInitializedChanged; #endif + // Ensure RuntimeConfig is applied before each scenario to preserve ForceDriver setting + if (!Options.DontEnableConfigurationManagement && !string.IsNullOrEmpty (_forceDriver)) + { + ConfigurationManager.Load (ConfigLocations.Runtime); + ConfigurationManager.Apply (); + } + scenario.Main (); scenario.Dispose (); @@ -451,8 +468,6 @@ public class UICatalog scenario.StartBenchmark (); } - Application.ForceDriver = _forceDriver!; - scenario.Main (); BenchmarkResults? results = null;