Skip to content

Commit f6c1e8c

Browse files
[dotnet] Enable nullability on remote file download APIs (#15351)
1 parent 8d25bef commit f6c1e8c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

dotnet/src/webdriver/IHasDownloads.cs

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
using System.Collections.Generic;
2121

22+
#nullable enable
23+
2224
namespace OpenQA.Selenium
2325
{
2426
/// <summary>

dotnet/src/webdriver/Remote/RemoteWebDriver.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -530,15 +530,16 @@ public IReadOnlyList<string> GetDownloadableFiles()
530530
throw new WebDriverException("GetDownloadableFiles returned successfully, but response content was not an object: " + commandResponse.Value);
531531
}
532532

533-
object[] namesArray = (object[])value["names"]!;
534-
return namesArray.Select(obj => obj.ToString()!).ToList();
533+
object?[] namesArray = (object?[])value["names"]!;
534+
return namesArray.Select(obj => obj!.ToString()!).ToList();
535535
}
536536

537537
/// <summary>
538538
/// Downloads a file with the specified file name.
539539
/// </summary>
540540
/// <param name="fileName">The name of the file to be downloaded.</param>
541541
/// <param name="targetDirectory">The target directory where the file should be downloaded to.</param>
542+
/// <exception cref="ArgumentNullException">If <paramref name="targetDirectory"/> is null.</exception>
542543
public void DownloadFile(string fileName, string targetDirectory)
543544
{
544545
var enableDownloads = this.Capabilities.GetCapability(CapabilityType.EnableDownloads);

0 commit comments

Comments
 (0)