Skip to content

Commit

Permalink
[dotnet] Address some build warnings (#15157)
Browse files Browse the repository at this point in the history
  • Loading branch information
nvborisenko authored Jan 25, 2025
1 parent d145537 commit 77796f4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/Cookie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public static Cookie FromDictionary(Dictionary<string, object> rawCookie)
{
if (rawCookie == null)
{
throw new ArgumentNullException(nameof(rawCookie), "Dictionary cannot be null");
throw new ArgumentNullException(nameof(rawCookie));
}

string name = rawCookie["name"].ToString();
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/CookieJar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void DeleteAllCookies()
{
var rawCookie = driver.InternalExecute(DriverCommand.GetCookie, new() { { "name", name } }).Value;

return Cookie.FromDictionary((Dictionary<string, object>)rawCookie);
return Cookie.FromDictionary((Dictionary<string, object>)rawCookie!);
}
catch (NoSuchCookieException)
{
Expand Down
10 changes: 8 additions & 2 deletions dotnet/src/webdriver/Internal/FileUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,18 @@ public static string GetCurrentDirectory()

string currentDirectory = location!;

#if !NET8_0_OR_GREATER
// If we're shadow copying, get the directory from the codebase instead
if (AppDomain.CurrentDomain.ShadowCopyFiles)
{
Uri uri = new Uri(executingAssembly.CodeBase);
currentDirectory = Path.GetDirectoryName(uri.LocalPath)!;
var codeBase = executingAssembly.CodeBase;

if (codeBase is not null)
{
currentDirectory = Path.GetDirectoryName(codeBase);
}
}
#endif

return currentDirectory;
}
Expand Down

0 comments on commit 77796f4

Please sign in to comment.