Skip to content

Commit 69db9b1

Browse files
committed
[dotnet] Address some build warnings
1 parent d145537 commit 69db9b1

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

dotnet/src/webdriver/Cookie.cs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,18 @@ public static string GetCurrentDirectory()
188188

189189
string currentDirectory = location!;
190190

191+
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+
#pragma warning disable SYSLIB0012 // Type or member is obsolete
196+
var codeBase = executingAssembly.CodeBase;
197+
#pragma warning restore SYSLIB0012 // Type or member is obsolete
198+
199+
if (codeBase is not null)
200+
{
201+
currentDirectory = Path.GetDirectoryName(codeBase)!;
202+
}
196203
}
197204

198205
return currentDirectory;

0 commit comments

Comments
 (0)