Skip to content

Commit 622f761

Browse files
[dotnet] Increment WebDriver towards nullability (#15228)
* [dotnet] Increment `WebDriver` towards nullability * minimize some diffs with error throwing * further minimize some diffs with error throwing * Annotate more of `WebDriver`, leaving only the commands where we need to read the spec for * fix nullability of adjacent types * remove changes to Execute * remove more * revert final change about Execute * Executing null command name throws, document this * Use new `EnsureValueIsNotNull` helper * cleanup * `Execute` cannot return `null`
1 parent 129da86 commit 622f761

File tree

4 files changed

+131
-135
lines changed

4 files changed

+131
-135
lines changed

dotnet/src/webdriver/Command.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ 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+
/// <exception cref="ArgumentNullException">If <paramref name="name"/> is <see langword="null"/>.</exception>
5859
public Command(SessionId? sessionId, string name, Dictionary<string, object>? parameters)
5960
{
6061
this.SessionId = sessionId;
6162
this.Parameters = parameters ?? new Dictionary<string, object>();
62-
this.Name = name;
63+
this.Name = name ?? throw new ArgumentNullException(nameof(name));
6364
}
6465

6566
/// <summary>

dotnet/src/webdriver/CommandInfoRepository.cs

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public bool IsCommandNameDefined(string commandName)
8787
/// </summary>
8888
/// <param name="commandName">The <see cref="DriverCommand"/> for which to get the information.</param>
8989
/// <returns>The <see cref="HttpCommandInfo"/> for the specified command, or <see langword="null"/> if not found or value is not <typeparamref name="T"/>.</returns>
90+
/// <exception cref="ArgumentNullException">If <paramref name="commandName"/> is <see langword="null"/>.</exception>
9091
public T? GetCommandInfo<T>(string commandName) where T : CommandInfo
9192
{
9293
T? toReturn = default;

0 commit comments

Comments
 (0)