Skip to content

Commit 0e3754a

Browse files
committed
Default values to null instead of sentinel values.
1 parent c9be903 commit 0e3754a

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

dotnet/src/webdriver/Chromium/ChromiumDriverService.cs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,25 @@ protected ChromiumDriverService(string executablePath, string executableFileName
4747
/// <para>Gets or sets the location of the log file written to by the ChromeDriver executable.</para>
4848
/// <para><see langword="null"/> or <see cref="string.Empty"/> signify no log path.</para>
4949
/// </summary>
50-
public string? LogPath { get; set; } = string.Empty;
50+
public string? LogPath { get; set; }
5151

5252
/// <summary>
5353
/// <para>Gets or sets the base URL path prefix for commands (e.g., "wd/url").</para>
5454
/// <para><see langword="null"/> or <see cref="string.Empty"/> signify no prefix.</para>
5555
/// </summary>
56-
public string? UrlPathPrefix { get; set; } = string.Empty;
56+
public string? UrlPathPrefix { get; set; }
5757

5858
/// <summary>
5959
/// <para>Gets or sets the address of a server to contact for reserving a port.</para>
6060
/// <para><see langword="null"/> or <see cref="string.Empty"/> signify no port server.</para>
6161
/// </summary>
62-
public string PortServerAddress { get; set; } = string.Empty;
62+
public string? PortServerAddress { get; set; }
6363

6464
/// <summary>
6565
/// <para>Gets or sets the port on which the Android Debug Bridge is listening for commands.</para>
66-
/// <para>A value less than or equal to 0 indicates no Android Debug Bridge specified.</para>
66+
/// <para>A value less than or equal to 0, or <see langword="null"/>, indicates no Android Debug Bridge specified.</para>
6767
/// </summary>
68-
public int AndroidDebugBridgePort { get; set; } = -1;
68+
public int? AndroidDebugBridgePort { get; set; }
6969

7070
/// <summary>
7171
/// Gets or sets a value indicating whether to skip version compatibility check
@@ -87,23 +87,21 @@ protected ChromiumDriverService(string executablePath, string executableFileName
8787
public bool EnableAppendLog { get; set; }
8888

8989
/// <summary>
90-
/// Gets or sets the comma-delimited list of IP addresses that are approved to
91-
/// connect to this instance of the Chrome driver. Defaults to an empty string,
92-
/// which means only the local loopback address can connect.
90+
/// <para>Gets or sets the comma-delimited list of IP addresses that are approved to connect to this instance of the Chrome driver.</para>
91+
/// <para>A value of <see langword="null"/> or <see cref="string.Empty"/> means only the local loopback address can connect.</para>
9392
/// </summary>
9493
[Obsolete($"Use {nameof(AllowedIPAddresses)}")]
95-
public string WhitelistedIPAddresses
94+
public string? WhitelistedIPAddresses
9695
{
9796
get => this.AllowedIPAddresses;
9897
set => this.AllowedIPAddresses = value;
9998
}
10099

101100
/// <summary>
102-
/// Gets or sets the comma-delimited list of IP addresses that are approved to
103-
/// connect to this instance of the Chrome driver. Defaults to an empty string,
104-
/// which means only the local loopback address can connect.
101+
/// <para>Gets or sets the comma-delimited list of IP addresses that are approved to connect to this instance of the Chrome driver.</para>
102+
/// <para>A value of <see langword="null"/> or <see cref="string.Empty"/> means only the local loopback address can connect.</para>
105103
/// </summary>
106-
public string AllowedIPAddresses { get; set; } = string.Empty;
104+
public string? AllowedIPAddresses { get; set; }
107105

108106
/// <summary>
109107
/// Gets the command-line arguments for the driver service.
@@ -113,9 +111,9 @@ protected override string CommandLineArguments
113111
get
114112
{
115113
StringBuilder argsBuilder = new StringBuilder(base.CommandLineArguments);
116-
if (this.AndroidDebugBridgePort > 0)
114+
if (this.AndroidDebugBridgePort is int adb && adb > 0)
117115
{
118-
argsBuilder.AppendFormat(CultureInfo.InvariantCulture, " --adb-port={0}", this.AndroidDebugBridgePort);
116+
argsBuilder.AppendFormat(CultureInfo.InvariantCulture, " --adb-port={0}", adb);
119117
}
120118

121119
if (this.SuppressInitialDiagnosticInformation)

0 commit comments

Comments
 (0)