Skip to content

Commit 32dd1b3

Browse files
committed
Suppressing warnings
1 parent 123e664 commit 32dd1b3

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

dotnet/src/webdriver/Firefox/FirefoxOptions.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,11 @@ public override ICapabilities ToCapabilities()
325325
}
326326
else
327327
{
328-
capabilities.SetCapability(FirefoxBinaryCapability, new FirefoxBinary().BinaryExecutable.ExecutablePath);
328+
using (FirefoxBinary executablePathBinary = new FirefoxBinary())
329+
{
330+
string executablePath = executablePathBinary.BinaryExecutable.ExecutablePath;
331+
capabilities.SetCapability(FirefoxBinaryCapability, executablePath);
332+
}
329333
}
330334
}
331335

@@ -352,10 +356,13 @@ private Dictionary<string, object> GenerateFirefoxOptionsDictionary()
352356
}
353357
else
354358
{
355-
string executablePath = new FirefoxBinary().BinaryExecutable.ExecutablePath;
356-
if (!string.IsNullOrEmpty(executablePath))
359+
using (FirefoxBinary executablePathBinary = new FirefoxBinary())
357360
{
358-
firefoxOptions[FirefoxBinaryCapability] = executablePath;
361+
string executablePath = executablePathBinary.BinaryExecutable.ExecutablePath;
362+
if (!string.IsNullOrEmpty(executablePath))
363+
{
364+
firefoxOptions[FirefoxBinaryCapability] = executablePath;
365+
}
359366
}
360367
}
361368

dotnet/src/webdriver/GlobalSuppressions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multiprocess", Scope = "member", Target = "OpenQA.Selenium.Firefox.FirefoxDriverService.#DisableBrowserMultiprocessSupport", Justification = "Multiprocess is correctly spelled.")]
7171
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "x", Scope = "member", Target = "OpenQA.Selenium.Interactions.PointerInputDevice.#CreatePointerMove(OpenQA.Selenium.IWebElement,OpenQA.Selenium.Interactions.CoordinateOrigin,System.Int32,System.Int32,System.TimeSpan)", Justification = "An x-offset is an appropriate name for the parameter.")]
7272
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "y", Scope = "member", Target = "OpenQA.Selenium.Interactions.PointerInputDevice.#CreatePointerMove(OpenQA.Selenium.IWebElement,OpenQA.Selenium.Interactions.CoordinateOrigin,System.Int32,System.Int32,System.TimeSpan)", Justification = "A y-offset is an appropriate name for the parameter.")]
73+
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Png", Scope = "member", Target = "OpenQA.Selenium.ScreenshotImageFormat.#Png", Justification = "PNG is the propert term for Portable Network Graphics.")]
7374
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "OpenQA.Selenium.Cookie.#ExpirySeconds", Justification = "This property only exists so that the JSON serializer can serialize a cookie without resorting to a custom converter.")]
7475
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Scope = "member", Target = "OpenQA.Selenium.Remote.ErrorResponse.#StackTrace", Justification = "Specification compliance demands use of an array.")]
7576
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Scope = "member", Target = "OpenQA.Selenium.Screenshot.#AsByteArray", Justification = "Specification compliance demands use of an array.")]
@@ -84,6 +85,7 @@
8485
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "OpenQA.Selenium.PhantomJS.PhantomJSDriver.#.ctor(OpenQA.Selenium.PhantomJS.PhantomJSOptions)", Justification = "Driver ensures that all dependent service objects are properly disposed.")]
8586
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "OpenQA.Selenium.PhantomJS.PhantomJSDriver.#.ctor(System.String,OpenQA.Selenium.PhantomJS.PhantomJSOptions,System.TimeSpan)", Justification = "Driver ensures that all dependent service objects are properly disposed.")]
8687
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "OpenQA.Selenium.Safari.SafariDriver.#.ctor(OpenQA.Selenium.Safari.SafariOptions)", Justification = "Driver ensures that all dependent service objects are properly disposed.")]
88+
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "OpenQA.Selenium.Safari.SafariDriver.#.ctor(System.String,OpenQA.Selenium.Safari.SafariOptions,System.TimeSpan)", Justification = "Driver ensures that all dependent service objects are properly disposed.")]
8789
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "OpenQA.Selenium.Firefox.FirefoxDriver.#.ctor(OpenQA.Selenium.Firefox.FirefoxOptions)", Justification = "Driver ensures that all dependent service objects are properly disposed.")]
8890
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "OpenQA.Selenium.Firefox.FirefoxDriver.#.ctor()", Justification = "Driver ensures that all dependent service objects are properly disposed.")]
8991
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Scope = "member", Target = "OpenQA.Selenium.Firefox.FirefoxDriver.#.ctor(OpenQA.Selenium.Firefox.FirefoxProfile)", Justification = "Driver ensures that all dependent service objects are properly disposed.")]
@@ -99,3 +101,9 @@
99101
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "HasWebStorage", Scope = "member", Target = "OpenQA.Selenium.Remote.RemoteWebDriver.#WebStorage", Justification = "HasWebStorage property name is properly spelled")]
100102
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "geolocation", Scope = "member", Target = "OpenQA.Selenium.Remote.RemoteWebDriver.#LocationContext", Justification = "Geolocation is properly spelled")]
101103
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors", Scope = "member", Target = "OpenQA.Selenium.Remote.RemoteWebDriver.#.ctor(OpenQA.Selenium.Remote.ICommandExecutor,OpenQA.Selenium.ICapabilities)", Justification = "Class provides a hook for subclasses to modify functionality, so virtual method call in constructor is appropriate.")]
104+
105+
// Temporary suppressions until Interactions API is fully updated.
106+
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "OpenQA.Selenium.Interactions.PauseInteraction.#.ctor(OpenQA.Selenium.Interactions.InputDevice)", Justification = "Temporary suppressions until Interactions API is made public.")]
107+
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "OpenQA.Selenium.Interactions.PointerInputDevice.#.ctor(OpenQA.Selenium.Interactions.PointerKind)", Justification = "Temporary suppressions until Interactions API is made public.")]
108+
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "OpenQA.Selenium.Interactions.PointerInputDevice.#CreatePointerCancel()", Justification = "Temporary suppressions until Interactions API is made public.")]
109+
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "OpenQA.Selenium.Interactions.PointerInputDevice+PointerCancelInteraction.#.ctor(OpenQA.Selenium.Interactions.InputDevice)", Justification = "Temporary suppressions until Interactions API is made public.")]

dotnet/src/webdriver/Remote/RemoteTimeouts.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
using System;
2020
using System.Collections.Generic;
21+
using System.Globalization;
2122

2223
namespace OpenQA.Selenium.Remote
2324
{
@@ -145,7 +146,7 @@ private TimeSpan ExecuteGetTimeout(string timeoutType)
145146
throw new WebDriverException("Specified timeout type not defined");
146147
}
147148

148-
return TimeSpan.FromMilliseconds(Convert.ToDouble(responseValue[timeoutType]));
149+
return TimeSpan.FromMilliseconds(Convert.ToDouble(responseValue[timeoutType], CultureInfo.InvariantCulture));
149150
}
150151
else
151152
{

0 commit comments

Comments
 (0)