Skip to content

Commit 4060d7c

Browse files
committed
fix nullability of adjacent types
1 parent 43012fd commit 4060d7c

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

dotnet/src/webdriver/Command.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ public Command(string name, string jsonParameters)
5555
/// <param name="sessionId">Session ID the driver is using</param>
5656
/// <param name="name">Name of the command</param>
5757
/// <param name="parameters">Parameters for that command</param>
58-
public Command(SessionId? sessionId, string name, Dictionary<string, object>? parameters)
58+
public Command(SessionId? sessionId, string name, Dictionary<string, object?>? parameters)
5959
{
6060
this.SessionId = sessionId;
61-
this.Parameters = parameters ?? new Dictionary<string, object>();
61+
this.Parameters = parameters ?? new Dictionary<string, object?>();
6262
this.Name = name;
6363
}
6464

@@ -78,7 +78,7 @@ public Command(SessionId? sessionId, string name, Dictionary<string, object>? pa
7878
/// Gets the parameters of the command
7979
/// </summary>
8080
[JsonPropertyName("parameters")]
81-
public Dictionary<string, object> Parameters { get; }
81+
public Dictionary<string, object?> Parameters { get; }
8282

8383
/// <summary>
8484
/// Gets the parameters of the command as a JSON-encoded string.
@@ -117,9 +117,9 @@ public override string ToString()
117117
/// <returns>A <see cref="Dictionary{K, V}"/> with a string keys, and an object value. </returns>
118118
/// <exception cref="JsonException">If <paramref name="value"/> is not a JSON object.</exception>
119119
/// <exception cref="ArgumentNullException">If <paramref name="value"/> is <see langword="null"/>.</exception>
120-
private static Dictionary<string, object>? ConvertParametersFromJson(string value)
120+
private static Dictionary<string, object?>? ConvertParametersFromJson(string value)
121121
{
122-
Dictionary<string, object>? parameters = JsonSerializer.Deserialize<Dictionary<string, object>>(value, s_jsonSerializerOptions);
122+
Dictionary<string, object?>? parameters = JsonSerializer.Deserialize<Dictionary<string, object?>>(value, s_jsonSerializerOptions);
123123
return parameters;
124124
}
125125
}

dotnet/src/webdriver/ICustomDriverCommandExecutor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public interface ICustomDriverCommandExecutor
3636
/// <param name="parameters">A <see cref="Dictionary{K, V}"/> containing the names and values of the parameters of the command.</param>
3737
/// <returns>An object that contains the value returned by the command, if any.</returns>
3838
/// <exception cref="WebDriverException">The command returned an exceptional value.</exception>
39-
object? ExecuteCustomDriverCommand(string driverCommandToExecute, Dictionary<string, object> parameters);
39+
object? ExecuteCustomDriverCommand(string driverCommandToExecute, Dictionary<string, object?>? parameters);
4040

4141
/// <summary>
4242
/// Registers a set of commands to be executed with this driver instance.

dotnet/src/webdriver/VirtualAuth/Credential.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ public static Credential FromDictionary(Dictionary<string, object> dictionary)
124124
/// Serializes this Credential instance to a dictionary.
125125
/// </summary>
126126
/// <returns>The dictionary containing the values for this Credential.</returns>
127-
public Dictionary<string, object> ToDictionary()
127+
public Dictionary<string, object?> ToDictionary()
128128
{
129-
Dictionary<string, object> toReturn = new Dictionary<string, object>();
129+
Dictionary<string, object?> toReturn = new Dictionary<string, object?>();
130130

131131
toReturn["credentialId"] = Base64UrlEncoder.Encode(this.id);
132132
toReturn["isResidentCredential"] = this.IsResidentCredential;

dotnet/src/webdriver/VirtualAuth/VirtualAuthenticatorOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ public VirtualAuthenticatorOptions SetIsUserVerified(bool isUserVerified)
172172
/// Serializes this set of options into a dictionary of key-value pairs.
173173
/// </summary>
174174
/// <returns>The dictionary containing the values of this set of options.</returns>
175-
public Dictionary<string, object> ToDictionary()
175+
public Dictionary<string, object?> ToDictionary()
176176
{
177-
Dictionary<string, object> toReturn = new Dictionary<string, object>();
177+
Dictionary<string, object?> toReturn = new Dictionary<string, object?>();
178178

179179
toReturn["protocol"] = this.protocol;
180180
toReturn["transport"] = this.transport;

dotnet/src/webdriver/WebElementFactory.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public WebElementFactory(WebDriver parentDriver)
4949
/// </summary>
5050
/// <param name="elementDictionary">The dictionary containing the element reference.</param>
5151
/// <returns>A <see cref="WebElement"/> containing the information from the specified dictionary.</returns>
52-
public virtual WebElement CreateElement(Dictionary<string, object> elementDictionary)
52+
public virtual WebElement CreateElement(Dictionary<string, object?> elementDictionary)
5353
{
5454
string elementId = this.GetElementId(elementDictionary);
5555
return new WebElement(this.ParentDriver, elementId);
@@ -60,7 +60,7 @@ public virtual WebElement CreateElement(Dictionary<string, object> elementDictio
6060
/// </summary>
6161
/// <param name="elementDictionary">The dictionary to check.</param>
6262
/// <returns><see langword="true"/> if the dictionary contains an element reference; otherwise, <see langword="false"/>.</returns>
63-
public bool ContainsElementReference(Dictionary<string, object> elementDictionary)
63+
public bool ContainsElementReference(Dictionary<string, object?> elementDictionary)
6464
{
6565
if (elementDictionary == null)
6666
{
@@ -78,7 +78,7 @@ public bool ContainsElementReference(Dictionary<string, object> elementDictionar
7878
/// <exception cref="ArgumentNullException">If <paramref name="elementDictionary"/> is <see langword="null"/>.</exception>
7979
/// <exception cref="ArgumentException">If the dictionary does not contain the element reference property name.</exception>
8080
/// <exception cref="InvalidOperationException">If the element property is <see langword="null"/> or <see cref="string.Empty"/>.</exception>
81-
public string GetElementId(Dictionary<string, object> elementDictionary)
81+
public string GetElementId(Dictionary<string, object?> elementDictionary)
8282
{
8383
if (elementDictionary == null)
8484
{
@@ -90,13 +90,13 @@ public string GetElementId(Dictionary<string, object> elementDictionary)
9090
throw new ArgumentException("elementDictionary", "The specified dictionary does not contain an element reference");
9191
}
9292

93-
string? elementId = elementIdObj.ToString();
93+
string? elementId = elementIdObj?.ToString();
9494
if (string.IsNullOrEmpty(elementId))
9595
{
9696
throw new InvalidOperationException("The specified element ID is either null or the empty string.");
9797
}
9898

99-
return elementId;
99+
return elementId!;
100100
}
101101
}
102102
}

0 commit comments

Comments
 (0)