-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 nullability annotations to devtools domains #15143
base: trunk
Are you sure you want to change the base?
Conversation
|
||
foreach (var value in values) | ||
{ | ||
var enumMember = type.GetMember(value.ToString())[0]; | ||
var enumMember = type.GetField(value.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.
Since we know type
is an enum, we know each of the values are fields.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
||
return domains; | ||
ConstructorInfo constructor = domainType.GetConstructor(new Type[] { typeof(DevToolsSession) })!; | ||
return (DevToolsDomains)constructor.Invoke(new object[] { session }); |
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.
The existing code checks for missing constructors, but this can never be the case. We know the 4 possible domain types. All of them have the right constructor, and are an instance of the DevToolsDomains
type.
Looking around at how this method is used, it is expected that the returned value is not null. Otherwise, we would be getting null reference exceptions.
User description
Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Add nullability annotations to devtools domains, as well as some event args I missed in a previous PR.
Motivation and Context
Contributes to #14640
Types of changes
Checklist
PR Type
Enhancement, Bug fix
Description
Added nullability annotations to multiple DevTools-related classes.
Improved immutability by replacing mutable properties with readonly or auto-properties.
Enhanced exception handling and safety with nullability checks and improved constructors.
Updated enum handling with conditional compilation for .NET 8.0 and above.
Changes walkthrough 📝
9 files
Added nullability annotations and improved constructor handling.
Enabled nullability annotations for extension methods.
Enabled nullability annotations for DevTools options.
Added nullability annotations and improved immutability.
Added nullability annotations and made properties readonly.
Enabled nullability annotations for log message event args.
Added nullability annotations and improved constructor usage.
Enhanced enum handling with nullability and .NET 8.0 support.
Enabled nullability annotations for response paused event args.
4 files
Improved exception handling with constructor-based initialization.
Improved exception handling with constructor-based initialization.
Improved exception handling with constructor-based initialization.
Improved exception handling with constructor-based initialization.