You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The GetCapability method returns nullable object but AcceptInsecureCerts property assumes non-null when casting to bool. This could cause runtime exceptions.
Why: The suggestion improves type safety by using pattern matching instead of direct casting, preventing potential runtime InvalidCastException if capabilityValue is not a boolean type.
Medium
Improve null safety handling
Use pattern matching to safely handle null case in GetAlwaysMatchOptionsAsSerializableDictionary to prevent potential NullReferenceException.
Why: While the suggestion uses pattern matching for null checking, the existing null-conditional operator (?.) already provides adequate null safety. The improvement is mainly stylistic with minimal impact on functionality.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Description
Annotate nullability on capabilities types
Motivation and Context
Contributes to #14640
Types of changes
Checklist
PR Type
Enhancement
Description
Enabled nullable reference types in multiple files for better null safety.
Updated method signatures and properties to support nullable types.
Simplified logic using null-coalescing operators and pattern matching.
Improved internal data structures with readonly collections and HashSet.
Changes walkthrough 📝
IHasCapabilities.cs
Enable nullable reference types in interfacedotnet/src/webdriver/IHasCapabilities.cs
IWritableCapabilities.cs
Enable nullable reference types in writable capabilitiesdotnet/src/webdriver/IWritableCapabilities.cs
DesiredCapabilities.cs
Improve null safety in DesiredCapabilitiesdotnet/src/webdriver/Remote/DesiredCapabilities.cs
ReadOnlyDesiredCapabilities.cs
Enhance null safety in ReadOnlyDesiredCapabilitiesdotnet/src/webdriver/Remote/ReadOnlyDesiredCapabilities.cs
RemoteSessionSettings.cs
Improve null safety in RemoteSessionSettingsdotnet/src/webdriver/Remote/RemoteSessionSettings.cs