-
-
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] Remove JSON serialization from .ToString()
methods
#14736
[dotnet] Remove JSON serialization from .ToString()
methods
#14736
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
I like that this PR excludes json serialization from The next question: what we want to see as a string representation of any object? While I was walking through codebase, I don't see strong rule for objects. Yeah, json representation is still showing everything, but in general it is not ideal way to represent any object as a string. @RenderMichael what if I propose just to remove |
@nvborisenko I completely agree, the three types with JSON serialization in the Should I open a separate issue for discussion? |
If we want to be careful and alert users, we can change the ToString to public string ToString() => $"{base.ToString()}, Use ToCapabilities() for a serializable representation."; |
Only 3 types? Then I propose to remove ToString() in this PR, and think of about it in separate PR. Discussion will be happened there, not here. Thank you! |
Opened #14741 |
Let's do it: |
Done! PR is ready for review |
From all ToString(), then we can consider #14741 as fixed. |
All 3 types are ready. Such a satisfying change |
Thank you, while you are adjusting PR's topic/description, I will validate that Appium project doesn't use |
Hopefully they are not calling |
DriverOptions.ToString()
.ToString()
methods
You can help me, they are more friendly for .net: https://github.com/appium/dotnet-client (at least at compilation level) |
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.
Thanks Michael!
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 removes the
ToString()
method onDriverOptions
,ReturnedCapabilities
, andRemoteSessionSettings
, to avoid heavy and AOT-unsafe JSON serialization.Offshoot of #14734
Motivation and Context
There is an ongoing effort to make operations AOT-safe. Additionally, this
ToString()
method is heavy, which can be especially taxing when looking at the debugger display for the instance.Fixes #14741
Types of changes
Checklist
PR Type
Enhancement, Tests
Description
DriverOptions.ToString()
method by removing JSON serialization and implementing a custom string representation usingStringBuilder
.ToString()
method across different browser options (Chrome, Edge, Firefox, Internet Explorer, Safari) to verify the output format.Changes walkthrough 📝
DriverOptions.cs
Simplify `DriverOptions.ToString()` method for AOT safety
dotnet/src/webdriver/DriverOptions.cs
ToString()
method.StringBuilder
.ChromeSpecificTests.cs
Add test for ChromeOptions ToString method
dotnet/test/chrome/ChromeSpecificTests.cs
ChromeOptions.ToString()
method.EdgeSpecificTests.cs
Add test for EdgeOptions ToString method
dotnet/test/edge/EdgeSpecificTests.cs
EdgeOptions.ToString()
method.FirefoxDriverTest.cs
Add test for FirefoxOptions ToString method
dotnet/test/firefox/FirefoxDriverTest.cs
FirefoxOptions.ToString()
method.IeSpecificTests.cs
Add test for InternetExplorerOptions ToString method
dotnet/test/ie/IeSpecificTests.cs
InternetExplorerOptions.ToString()
method.SafariSpecificTests.cs
Add test for SafariOptions ToString method
dotnet/test/safari/SafariSpecificTests.cs
SafariOptions.ToString()
method.