-
-
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] Move Response
constructors towards immutability
#14998
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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
This moves all
Response
constructors to a single constructor which requires all values specified at ctor time.Motivation and Context
Moves us towards immutability of the
Response
type. Eventually, we may be able to remove theset
ters from some values, but that's not crucial.This also moves us towards aspirational goals of storing a
JsonNode
for theValue
alongside the de-serializedobject
, which would help with bugs such as #14846 and many others involving incorrect de-serialization, especially with.ToString()
invocations on dictionaries/lists, andas
casts when the type is not a match.Types of changes
Checklist
PR Type
Enhancement
Description
New immutable Response constructor requiring all values
Refactored response creation methods for better immutability
Improved error handling and null checks
Simplified JSON deserialization and response construction
Changes walkthrough 📝
HttpCommandExecutor.cs
Refactor response creation to use immutable constructor
dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
Response.cs
Implement immutable Response construction pattern
dotnet/src/webdriver/Response.cs