Fixes #4139. Application.Run<T> isn't initializing properly by setting the Application.ForceDriver property (#4142)

* Fixes #4139. Application.Run<T> isn't initializing properly by setting the Application.ForceDriver property

* Trying fix unit tests

* Only to force again CI tests because I haven't errors locally

* This should pass, unless RunningUnitTests is set to false somewhere

* Fix Unix unit tests and failures via ReSharper

* Changes suggested by @tig

* Prevent empty string

* Centralize all the entry logic in the InternalInit method

* Change GetDriverTypes to return a tuple
This commit is contained in:
BDisp
2025-06-12 17:48:05 +01:00
committed by GitHub
parent 76b7e52e12
commit ad1de255b1
17 changed files with 257 additions and 47 deletions

View File

@@ -12,6 +12,10 @@
"commandName": "Project",
"commandLineArgs": "--driver WindowsDriver"
},
"UICatalog --driver v2": {
"commandName": "Project",
"commandLineArgs": "--driver v2 -dl Trace"
},
"UICatalog --driver v2win": {
"commandName": "Project",
"commandLineArgs": "--driver v2win -dl Trace"
@@ -32,6 +36,18 @@
"commandLineArgs": "dotnet UICatalog.dll --driver NetDriver",
"distributionName": ""
},
"WSL: UICatalog --driver v2": {
"commandName": "Executable",
"executablePath": "wsl",
"commandLineArgs": "dotnet UICatalog.dll --driver v2",
"distributionName": ""
},
"WSL: UICatalog --driver v2net": {
"commandName": "Executable",
"executablePath": "wsl",
"commandLineArgs": "dotnet UICatalog.dll --driver v2net",
"distributionName": ""
},
"Benchmark All": {
"commandName": "Project",
"commandLineArgs": "--benchmark"

View File

@@ -54,7 +54,7 @@ namespace UICatalog;
/// </remarks>
public class UICatalog
{
private static string _forceDriver = string.Empty;
private static string? _forceDriver = null;
public static string LogFilePath { get; set; } = string.Empty;
public static LoggingLevelSwitch LogLevelSwitch { get; } = new ();
@@ -77,11 +77,7 @@ public class UICatalog
// If no driver is provided, the default driver is used.
Option<string> driverOption = new Option<string> ("--driver", "The IConsoleDriver to use.").FromAmong (
Application.GetDriverTypes ()
.Where (d => !typeof (IConsoleDriverFacade).IsAssignableFrom (d))
.Select (d => d!.Name)
.Union (["v2", "v2win", "v2net"])
.ToArray ()
Application.GetDriverTypes ().Item2.ToArray ()!
);
driverOption.AddAlias ("-d");
driverOption.AddAlias ("--d");