-
-
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] Lazy-load Selenium manager binary location #14639
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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.
Thank you! It can be even simplified to avoid cunning logic, please see inner comment.
Thanks for the feedback, the PR has been updated |
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.
Thank you!
Thank you @nvborisenko ! I dug into the record syntax that worked, and you were right, it was working. There may be some special support for records. However, the moment I added I'm not familiar with the STJ esoterica here, but it looks like what we have now works. Maybe once v9 comes out, the internal serialization options could enable the feature flags I linked and prevent null reference exceptions even further. |
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
The location of the selenium manager binary is calculated when it is first accessed.
Motivation and Context
I ran into this while working on #14480
It is considered bad practice for static constructors to throw exceptions. If an exception is throws, the type is rendered unusable for the rest of the application lifecycle. The stack-trace of the exception is also much harder to follow, and the debugging experience is worsened. The fact that it throws
TypeInitializationException
threw me off initially, because I was testing AOT at the time.Exceptions are expected on this flow, in exceptional cases, they are even thrown directly. With this change, the Stack trace changes:
Before:
After:
Types of changes
Checklist
PR Type
Enhancement
Description
GetBinaryFullPath
to determine the binary path dynamically.Changes walkthrough 📝
SeleniumManager.cs
Implement lazy-loading for Selenium Manager binary path
dotnet/src/webdriver/SeleniumManager.cs