-
-
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] Add trimming attributes, address some trim warnings #14637
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:
|
}; | ||
|
||
/// <summary>Workaround for trimming.</summary> |
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.
This is the kind of workaround necessary when using a Type
as a generic argument that requires trimming annotations. Hope this is acceptable.
TEnum[] values = Enum.GetValues<TEnum>(); | ||
#else | ||
Array values = Enum.GetValues(type); | ||
#endif | ||
foreach (var value in values) |
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.
var
here is actually TEnum
in .NET, but object
in .NET Standard. All use of value
is either cast or are ToString()
-ed, so there's no runtime difference.
I will start to review after basic #14574 is merged. I thought that CDP requires deeper knowledge, so on hold for now. |
@nvborisenko Thanks! It looks like a lot of the work you're doing could be addressed if It doesn't have much support because this kind of conversion isn't roundtrippable. Maybe Selenium can make the case for this functionality there? |
No, Source Generation in Json is very good. The problem I am trying to resolve is that many many years ago wire objects were serialized as You referenced to the issue, which is in open state... |
@nvborisenko Yeah the But, that would involve a lot of legwork. I would love to contribute any PRs if that's the direction this project wants to go down. |
I am in communication with https://github.com/appium/appium team, they are testing #14574 We should migrate "classic" before moving further. |
Unfortunately it is big boom breaking change :( |
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 improves the story for trimming/AOT using Selenium, specifically addressing non-JSON related warnings.
Motivation and Context
In furtherance of #14480
Types of changes
Checklist
PR Type
Enhancement, Other
Description
DevToolsDomains
class to improve AOT compatibility by introducing aDomainType
struct and usingDynamicallyAccessedMembers
attributes.JsonEnumMemberConverter
class by adding attributes for public fields and updating enum value retrieval for .NET 5.0 or greater.TrimmingAttributes.cs
with custom attributes to support trimming and AOT compatibility, including conditional compilation for different .NET versions.WebDriver.csproj
file to include a conditional AOT compatibility property for future .NET versions.Changes walkthrough 📝
DevToolsDomains.cs
Enhance DevToolsDomains for AOT compatibility
dotnet/src/webdriver/DevTools/DevToolsDomains.cs
DomainType
struct to handle trimming.DynamicallyAccessedMembers
attribute for public constructors.DomainType
instead ofType
.JsonEnumMemberConverter.cs
Improve JsonEnumMemberConverter for AOT compatibility
dotnet/src/webdriver/DevTools/Json/JsonEnumMemberConverter.cs
DynamicallyAccessedMembers
attribute for public fields.TrimmingAttributes.cs
Add custom trimming attributes for AOT support
dotnet/src/webdriver/Internal/TrimmingAttributes.cs
DynamicallyAccessedMembers
and related attributes.WebDriver.csproj
Update project file for potential AOT compatibility
dotnet/src/webdriver/WebDriver.csproj