[dotnet] Add reflection-based JSON serialization fallback to Commands#14732
[dotnet] Add reflection-based JSON serialization fallback to Commands#14732nvborisenko merged 2 commits intoSeleniumHQ:trunkfrom
Commands#14732Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
This is very good! Nice catch! |
|
In the short-term, this should stop all the JSON failures people may be having. In the long-term, this defeats some the purpose of source-generation. It's still faster, better, future-proof, etc. but it makes the AOT support "best effort". Instead, we may need separate overloads for the methods that take We can also add an extra parameter of Either way, the |
|
Short-term: this PR is very good for regular users (99%), for AOT let's review each particular case (if it happens). |
|
AOT is music to my ears :) One day this project can have the I made another small PR as part of incremental progress #14733 |
nvborisenko
left a comment
There was a problem hiding this comment.
Very good drug from headache!
User description
Fixes #14731
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
Adds a reflection-based JSON serialization fallback, preventing unchecked exceptions from breaking scenarios.
Motivation and Context
Exceptions are being thrown for unknown types, including anonymous types.
Types of changes
Checklist
PR Type
Bug fix, Tests
Description
Commandclass to handle unknown types, including anonymous types, preventing unchecked exceptions.CommandJsonSerializerContext.DefaultwithDefaultJsonTypeInfoResolver.Commandclass, ensuring robustness and correctness.Changes walkthrough 📝
Command.cs
Add reflection-based JSON serialization fallback in Command classdotnet/src/webdriver/Command.cs
JsonTypeInfoResolver.Combineto JSON serializer options.DefaultJsonTypeInfoResolverfor enhanced serialization.CommandTests.cs
Add tests for JSON serialization of Command classdotnet/test/common/CommandTests.cs
CommandTests.