Skip to content

Commit 77796f4

Browse files
authored
[dotnet] Address some build warnings (#15157)
1 parent d145537 commit 77796f4

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

dotnet/src/webdriver/Cookie.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public static Cookie FromDictionary(Dictionary<string, object> rawCookie)
277277
{
278278
if (rawCookie == null)
279279
{
280-
throw new ArgumentNullException(nameof(rawCookie), "Dictionary cannot be null");
280+
throw new ArgumentNullException(nameof(rawCookie));
281281
}
282282

283283
string name = rawCookie["name"].ToString();

dotnet/src/webdriver/CookieJar.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public void DeleteAllCookies()
127127
{
128128
var rawCookie = driver.InternalExecute(DriverCommand.GetCookie, new() { { "name", name } }).Value;
129129

130-
return Cookie.FromDictionary((Dictionary<string, object>)rawCookie);
130+
return Cookie.FromDictionary((Dictionary<string, object>)rawCookie!);
131131
}
132132
catch (NoSuchCookieException)
133133
{

dotnet/src/webdriver/Internal/FileUtilities.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,18 @@ public static string GetCurrentDirectory()
188188

189189
string currentDirectory = location!;
190190

191+
#if !NET8_0_OR_GREATER
191192
// If we're shadow copying, get the directory from the codebase instead
192193
if (AppDomain.CurrentDomain.ShadowCopyFiles)
193194
{
194-
Uri uri = new Uri(executingAssembly.CodeBase);
195-
currentDirectory = Path.GetDirectoryName(uri.LocalPath)!;
195+
var codeBase = executingAssembly.CodeBase;
196+
197+
if (codeBase is not null)
198+
{
199+
currentDirectory = Path.GetDirectoryName(codeBase);
200+
}
196201
}
202+
#endif
197203

198204
return currentDirectory;
199205
}

0 commit comments

Comments
 (0)