Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet] Address some build warnings #15157

Merged
merged 3 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
11 changes: 9 additions & 2 deletions dotnet/src/webdriver/Internal/FileUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,18 @@ public static string GetCurrentDirectory()

string currentDirectory = location!;


// 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)!;
#pragma warning disable SYSLIB0012 // Type or member is obsolete
var codeBase = executingAssembly.CodeBase;
#pragma warning restore SYSLIB0012 // Type or member is obsolete

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

return currentDirectory;
Expand Down
Loading