-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Add NRT to Manage()
and friends
#14669
base: trunk
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
public static Cookie FromDictionary(Dictionary<string, object> rawCookie) | ||
{ | ||
if (rawCookie == null) | ||
{ | ||
throw new ArgumentNullException(nameof(rawCookie), "Dictionary cannot be null"); | ||
} | ||
|
||
string name = rawCookie["name"].ToString(); | ||
string name = rawCookie["name"].ToString()!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If name
and value
are null, that'll surface in the constructor for Cookie. We can defer the null check here.
PR Code Suggestions ✨Explore these optional code suggestions:
|
{ | ||
Dictionary<string, object> parameters = new Dictionary<string, object>(); | ||
Dictionary<string, object?> parameters = new Dictionary<string, object?>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure how to handle this. When name
is null
, nothing seems to happen. So maybe we can do the same as DeleteCookie(Cookie)
below?
Description
Adds NRT annotations to methods and types reachable from the
driver.Manage()
method.Contributes to #14640
For methods that currently throw an exception of
null
is passed, that has been replaced with argument validation ahead of time. Likewise foras
casts that would benull reference
s. Other than that, no behavior changes are present.Motivation and Context
Nullable reference types aim to fix the billion dollar mistake.
Types of changes
Checklist
PR Type
enhancement, error handling
Description
ArgumentNullException
checks for methods that accept nullable parameters to enhance error handling.PRDescriptionHeader.CHANGES_WALKTHROUGH
18 files
Alert.cs
Enable nullable reference types and improve null handling in Alert
class
dotnet/src/webdriver/Alert.cs
commandResponse.Value.ToString()
.ArgumentNullException
forSendKeys
method.Cookie.cs
Enable nullable reference types and improve null handling in Cookie
class
dotnet/src/webdriver/Cookie.cs
ArgumentNullException
for null dictionary inFromDictionary
.CookieJar.cs
Enable nullable reference types and improve null handling in CookieJar
class
dotnet/src/webdriver/CookieJar.cs
ArgumentNullException
for null parameters.ICookieJar.cs
Enable nullable reference types and update ICookieJar interface
dotnet/src/webdriver/ICookieJar.cs
ILogs.cs
Enable nullable reference types and improve error handling in ILogs
interface
dotnet/src/webdriver/ILogs.cs
ArgumentNullException
forGetLog
method.INetwork.cs
Enable nullable reference types and improve null handling in INetwork
interface
dotnet/src/webdriver/INetwork.cs
ArgumentNullException
forAddRequestHandler
.IOptions.cs
Enable nullable reference types in IOptions interface
dotnet/src/webdriver/IOptions.cs
ITargetLocator.cs
Enable nullable reference types and improve error handling in
ITargetLocator interface
dotnet/src/webdriver/ITargetLocator.cs
ArgumentNullException
forWindow
method.ITimeouts.cs
Enable nullable reference types in ITimeouts interface
dotnet/src/webdriver/ITimeouts.cs
IWindow.cs
Enable nullable reference types in IWindow interface
dotnet/src/webdriver/IWindow.cs
ReturnedCookie.cs
Enable nullable reference types and update ReturnedCookie class
dotnet/src/webdriver/Internal/ReturnedCookie.cs
LogEntry.cs
Enable nullable reference types and improve error handling in LogEntry
class
dotnet/src/webdriver/LogEntry.cs
ArgumentNullException
forFromDictionary
method.Logs.cs
Enable nullable reference types and improve error handling in Logs
class
dotnet/src/webdriver/Logs.cs
ArgumentNullException
forGetLog
method.NetworkManager.cs
Enable nullable reference types and improve null handling in
NetworkManager class
dotnet/src/webdriver/NetworkManager.cs
ArgumentNullException
forAddRequestHandler
.OptionsManager.cs
Enable nullable reference types in OptionsManager class
dotnet/src/webdriver/OptionsManager.cs
TargetLocator.cs
Enable nullable reference types and improve error handling in
TargetLocator class
dotnet/src/webdriver/TargetLocator.cs
ArgumentNullException
forFrame
andWindow
methods.Timeouts.cs
Enable nullable reference types in Timeouts class
dotnet/src/webdriver/Timeouts.cs
Window.cs
Enable nullable reference types and update Window class
dotnet/src/webdriver/Window.cs