-
-
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] Fully annotate nullability on HttpCommandExecutor
#15110
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:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
} | ||
|
||
private void CreateHttpClient() | ||
private HttpClient Client |
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.
Changes look a lot simpler with whitespace turned off.
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.
Private properties are confusing. Take into account: https://github.com/SeleniumHQ/selenium/pull/15110/files#r1920848814
@@ -288,7 +300,7 @@ private async Task<HttpResponseInfo> MakeHttpRequest(HttpRequestInfo requestInfo | |||
requestMessage.Content.Headers.ContentType = contentTypeHeader; | |||
} | |||
|
|||
using (HttpResponseMessage responseMessage = await this.client.SendAsync(requestMessage).ConfigureAwait(false)) | |||
using (HttpResponseMessage responseMessage = await this.Client.SendAsync(requestMessage).ConfigureAwait(false)) |
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.
Nullability analysis was a lot simpler when changing CreateHttpClient()
into a lazy-loaded Client
.
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.
Please wait me here.
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.
Looks we can introduce Lazy<HttpClient>
as a field. Already thread-safe for initialization.
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
Finishes annotating
HttpCommandExecutor
for nullability. Refactor the client creation to play nicer with nullability analysis.Motivation and Context
Contributes to #14640
Types of changes
Checklist
PR Type
Enhancement, Bug fix
Description
Fully annotated nullability in
HttpCommandExecutor
class.Refactored
HttpClient
creation with thread-safe lazy initialization.Improved nullability handling for properties and events.
Replaced manual null checks with null-coalescing operators.
Changes walkthrough 📝
HttpCommandExecutor.cs
Annotate nullability and refactor `HttpCommandExecutor`
dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
HttpClient
creation to use a thread-safe lazyinitialization pattern.